text
stringlengths 0
234
|
---|
.pp |
.rs -4 |
feature test macro requirements for glibc (see |
.br feature_test_macros (7)): |
.re |
.pp |
.br open_memstream (), |
.br open_wmemstream (): |
.nf |
since glibc 2.10: |
_posix_c_source >= 200809l |
before glibc 2.10: |
_gnu_source |
.fi |
.sh description |
the |
.br open_memstream () |
function opens a stream for writing to a memory buffer. |
the function dynamically allocates the buffer, |
and the buffer automatically grows as needed. |
initially, the buffer has a size of zero. |
after closing the stream, the caller should |
.br free (3) |
this buffer. |
.pp |
the locations pointed to by |
.ir ptr |
and |
.i sizeloc |
are used to report, respectively, |
the current location and the size of the buffer. |
the locations referred to by these pointers are updated |
each time the stream is flushed |
.rb ( fflush (3)) |
and when the stream is closed |
.rb ( fclose (3)). |
these values remain valid only as long as the caller |
performs no further output on the stream. |
if further output is performed, then the stream |
must again be flushed before trying to access these values. |
.pp |
a null byte is maintained at the end of the buffer. |
this byte is |
.i not |
included in the size value stored at |
.ir sizeloc . |
.pp |
the stream maintains the notion of a current position, |
which is initially zero (the start of the buffer). |
each write operation implicitly adjusts the buffer position. |
the stream's buffer position can be explicitly changed with |
.br fseek (3) |
or |
.br fseeko (3). |
moving the buffer position past the end |
of the data already written fills the intervening space with |
null characters. |
.pp |
the |
.br open_wmemstream () |
is similar to |
.br open_memstream (), |
but operates on wide characters instead of bytes. |
.sh return value |
upon successful completion, |
.br open_memstream () |
and |
.br open_wmemstream () |
return a |
.i file |
pointer. |
otherwise, null is returned and |
.i errno |
is set to indicate the error. |
.sh versions |
.br open_memstream () |
was already available in glibc 1.0.x. |
.br open_wmemstream () |
is available since glibc 2.4. |
.sh attributes |
for an explanation of the terms used in this section, see |
.br attributes (7). |
.ad l |
.nh |
.ts |
allbox; |
lbx lb lb |
l l l. |
interface attribute value |
t{ |
.br open_memstream (), |
.br open_wmemstream () |
t} thread safety mt-safe |
.te |
.hy |
.ad |
.sp 1 |
.sh conforming to |
posix.1-2008. |
these functions are not specified in posix.1-2001, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.