aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2016-03-09 03:41:42 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2016-03-09 04:15:13 +0100
commit9c8b5ebfc4ca3ba4ffd9dab1d8829e3a7b2aea68 (patch)
tree57403d0c0c9fe2df14b50b567318790bfe8292b8
parent58c55bb87bbeab19268b6669d90154b6fd384239 (diff)
downloadman-pages-9c8b5ebfc4ca3ba4ffd9dab1d8829e3a7b2aea68.tar.gz
fmemopen.3: Rework description of 'buf' and 'len' arguments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man3/fmemopen.337
1 files changed, 22 insertions, 15 deletions
diff --git a/man3/fmemopen.3 b/man3/fmemopen.3
index 444b19356c..18c5d89a3e 100644
--- a/man3/fmemopen.3
+++ b/man3/fmemopen.3
@@ -93,6 +93,28 @@ is relative to the end of the buffer (i.e., the value specified by the
.I size
argument), rather than the current string length.
.PP
+If
+.I buf
+is specified as NULL, then
+.BR fmemopen ()
+allocates a buffer of
+.I size
+bytes.
+This is useful for an application that wants to write data to
+a temporary buffer and then read it back again.
+The initial position is set to the start of the buffer.
+The buffer is automatically freed when the stream is closed.
+Note that the caller has no way to obtain a pointer to the
+temporary buffer allocated by this call (but see
+.BR open_memstream ()
+below).
+.PP
+If
+.I buf
+is not NULL, then it should point to a buffer of at least
+.I len
+bytes allocated by the caller.
+.PP
When a stream that has been opened for writing is flushed
.RB ( fflush (3))
or closed
@@ -134,21 +156,6 @@ A read from the buffer will indicate end-of-file
only when the file pointer advances
.I size
bytes past the start of the buffer.
-.PP
-If
-.I buf
-is specified as NULL, then
-.BR fmemopen ()
-dynamically allocates a buffer
-.I size
-bytes long.
-This is useful for an application that wants to write data to
-a temporary buffer and then read it back again.
-The buffer is automatically freed when the stream is closed.
-Note that the caller has no way to obtain a pointer to the
-temporary buffer allocated by this call (but see
-.BR open_memstream ()
-below).
The
.BR open_memstream ()