open a memory buffer stream
functions create, respectively, a seekable byte-oriented or wide-oriented
stream for writing. A dynamically allocated buffer, using
is then wrapped to the pointer referenced by pbuf and
grows automatically as required.
When the stream is either closed or flushed, the address of the buffer is stored in the pointer referenced by pbuf. At the same time the smaller of the current position and the buffer length is written in the variable pointed to by psize. This value represents, respectively, the number of bytes or wide characters contained in the buffer, not including the terminating null character.
The buffer memory should be released after the stream is closed.
Upon successful completion,
open_wmemstream() return a
FILE pointer. Otherwise,
NULL is returned and the global variable
errno is set to indicate the error.
- The pbuf or the psize argument
open_wmemstream() functions may also fail and set
errno for any of the errors specified for the routine
fmemopen(3), fopen(3), funopen(3), malloc(3)
open_wmemstream(), conform to IEEE
Std 1003.1-2008 (“POSIX.1”).
open_wmemstream() functions first appeared in