mirror of https://github.com/mkerrisk/man-pages
fmemopen.3: Greatly expand description of 'mode' argument
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
02989b144e
commit
58c55bb87b
|
@ -51,19 +51,37 @@ function opens a stream that permits the access specified by
|
|||
The stream allows I/O to be performed on the string or memory buffer
|
||||
pointed to by
|
||||
.IR buf .
|
||||
This buffer must be at least
|
||||
.I size
|
||||
bytes long.
|
||||
|
||||
The
|
||||
.I mode
|
||||
argument specifies the semantics of I/O on the stream,
|
||||
and is one of the following:
|
||||
.TP 8
|
||||
.I r
|
||||
The stream is opened for reading.
|
||||
.TP
|
||||
.I w
|
||||
The stream is opened for writing.
|
||||
.TP
|
||||
.I a
|
||||
Append; open the stream for writing,
|
||||
with the file initial position set to the first null byte.
|
||||
.TP
|
||||
.I r+
|
||||
Open the stream for reading and writing.
|
||||
.TP
|
||||
.I w+
|
||||
Open the stream for reading and writing.
|
||||
The buffer contents are truncated
|
||||
(i.e., \(aq\\0\(aq is placed in the first byte of the buffer).
|
||||
.TP
|
||||
.I a+
|
||||
Append; open the stream for reading and writing,
|
||||
with the file initial position set to the first null byte.
|
||||
.PP
|
||||
In all modes other than append,
|
||||
the initial position is set to the start of the buffer.
|
||||
.PP
|
||||
The argument
|
||||
.I mode
|
||||
is the same as for
|
||||
.BR fopen (3).
|
||||
If
|
||||
.I mode
|
||||
specifies an append mode, then the initial file position is set to
|
||||
the location of the first null byte (\(aq\\0\(aq) in the buffer;
|
||||
otherwise the initial file position is set to the start of the buffer.
|
||||
Since glibc 2.9,
|
||||
the letter \(aqb\(aq may be specified as the second character in
|
||||
.IR mode .
|
||||
|
|
Loading…
Reference in New Issue