tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

pr_read.rst (1012B)


      1 PR_Read
      2 =======
      3 
      4 Reads bytes from a file or socket.
      5 
      6 
      7 Syntax
      8 ------
      9 
     10 .. code::
     11 
     12   #include <prio.h>
     13 
     14   PRInt32 PR_Read(PRFileDesc *fd,
     15                  void *buf,
     16                  PRInt32 amount);
     17 
     18 
     19 Parameters
     20 ~~~~~~~~~~
     21 
     22 The function has the following parameters:
     23 
     24 ``fd``
     25   A pointer to a :ref:`PRFileDesc` object for the file or socket.
     26 ``buf``
     27   A pointer to a buffer to hold the data read in. On output, the buffer
     28   contains the data.
     29 ``amount``
     30   The size of ``buf`` (in bytes).
     31 
     32 
     33 Returns
     34 ~~~~~~~
     35 
     36 One of the following values:
     37 
     38 -  A positive number indicates the number of bytes actually read in.
     39 -  The value 0 means end of file is reached or the network connection is
     40   closed.
     41 -  The value -1 indicates a failure. To get the reason for the failure,
     42   call :ref:`PR_GetError`.
     43 
     44 
     45 Description
     46 -----------
     47 
     48 The thread invoking :ref:`PR_Read` blocks until it encounters an
     49 end-of-stream indication, some positive number of bytes (but no more
     50 than ``amount`` bytes) are read in, or an error occurs.