summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_read.rst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /docs/nspr/reference/pr_read.rst
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/nspr/reference/pr_read.rst')
-rw-r--r--docs/nspr/reference/pr_read.rst50
1 files changed, 50 insertions, 0 deletions
diff --git a/docs/nspr/reference/pr_read.rst b/docs/nspr/reference/pr_read.rst
new file mode 100644
index 0000000000..a6d7c03efa
--- /dev/null
+++ b/docs/nspr/reference/pr_read.rst
@@ -0,0 +1,50 @@
+PR_Read
+=======
+
+Reads bytes from a file or socket.
+
+
+Syntax
+------
+
+.. code::
+
+ #include <prio.h>
+
+ PRInt32 PR_Read(PRFileDesc *fd,
+ void *buf,
+ PRInt32 amount);
+
+
+Parameters
+~~~~~~~~~~
+
+The function has the following parameters:
+
+``fd``
+ A pointer to a :ref:`PRFileDesc` object for the file or socket.
+``buf``
+ A pointer to a buffer to hold the data read in. On output, the buffer
+ contains the data.
+``amount``
+ The size of ``buf`` (in bytes).
+
+
+Returns
+~~~~~~~
+
+One of the following values:
+
+- A positive number indicates the number of bytes actually read in.
+- The value 0 means end of file is reached or the network connection is
+ closed.
+- The value -1 indicates a failure. To get the reason for the failure,
+ call :ref:`PR_GetError`.
+
+
+Description
+-----------
+
+The thread invoking :ref:`PR_Read` blocks until it encounters an
+end-of-stream indication, some positive number of bytes (but no more
+than ``amount`` bytes) are read in, or an error occurs.