pr_available.rst (1076B)
1 PR_Available 2 ============ 3 4 Determines the number of bytes (expressed as a 32-bit integer) that are 5 available for reading beyond the current read-write pointer in a 6 specified file or socket. 7 8 9 Syntax 10 ------ 11 12 .. code:: 13 14 #include <prio.h> 15 16 PRInt32 PR_Available(PRFileDesc *fd); 17 18 19 Parameter 20 ~~~~~~~~~ 21 22 The function has the following parameter: 23 24 ``fd`` 25 Pointer to a :ref:`PRFileDesc` object representing a file or socket. 26 27 28 Returns 29 ~~~~~~~ 30 31 The function returns one of the following values: 32 33 - If the function completes successfully, it returns the number of 34 bytes that are available for reading. For a normal file, these are 35 the bytes beyond the current file pointer. 36 - If the function fails, it returns the value -1. The error code can 37 then be retrieved via :ref:`PR_GetError`. 38 39 40 Description 41 ----------- 42 43 :ref:`PR_Available` works on normal files and sockets. :ref:`PR_Available` 44 does not work with pipes on Win32 platforms. 45 46 47 See Also 48 -------- 49 50 If the number of bytes available for reading is out of the range of a 51 32-bit integer, use :ref:`PR_Available64`.