open_memstream - Online Linux Manual PageSection : 3
Updated : 2022-12-15
Source : Linux man-pages 6.03
NAMEopen_memstream, open_wmemstream − open a dynamic memory buffer stream
LIBRARYStandard C library (libc, −lc)
SYNOPSIS#include <stdio.h>FILE *open_memstream(char **ptr, size_t *sizeloc);#include <wchar.h>FILE *open_wmemstream(wchar_t **ptr, size_t *sizeloc);Feature Test Macro Requirements for glibc (see feature_test_macros(7)): open_memstream(), open_wmemstream(): Since glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_GNU_SOURCE
DESCRIPTIONThe 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 free(3) this buffer. The locations pointed to by ptr and 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 (fflush(3)) and when the stream is closed (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. A null byte is maintained at the end of the buffer. This byte is not included in the size value stored at sizeloc. 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 fseek(3) or fseeko(3). Moving the buffer position past the end of the data already written fills the intervening space with null characters. The open_wmemstream() is similar to open_memstream(), but operates on wide characters instead of bytes.
RETURN VALUEUpon successful completion, open_memstream() and open_wmemstream() return a FILE pointer. Otherwise, NULL is returned and errno is set to indicate the error.
VERSIONSopen_memstream() was already available in glibc 1.0.x. open_wmemstream() is available since glibc 2.4.
ATTRIBUTESFor an explanation of the terms used in this section, see attributes(7). InterfaceAttributeValue open_memstream(), open_wmemstream() Thread safetyMT-Safe
STANDARDSPOSIX.1-2008. These functions are not specified in POSIX.1-2001, and are not widely available on other systems.
NOTESThere is no file descriptor associated with the file stream returned by these functions (i.e., fileno(3) will return an error if called on the returned stream).
BUGSBefore glibc 2.7, seeking past the end of a stream created by open_memstream() does not enlarge the buffer; instead the fseek(3) call fails, returning −1.
EXAMPLESSee fmemopen(3).
SEE ALSOfmemopen(3), fopen(3), setbuf(3) 0
Johanes Gumabo
Data Size : 12,157 byte
man-open_memstream.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 180,023
Visitor ID : :
Visitor IP : 3.145.166.223 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.