open_memstream man page on Cygwin

Man page or keyword search:  
man Server   22533 pages
apropos Keyword Search (all sections)
Output format
Cygwin logo
[printable version]

OPEN_MEMSTREAM(3)		    NEWLIB		     OPEN_MEMSTREAM(3)

NAME
       4.42 `open_memstream', `open_wmemstream'--open a write stream around an
       arbitrary-length string

SYNOPSIS
	    #include <stdio.h>
	    FILE *open_memstream(char **restrict BUF,
		size_t *restrict SIZE);

	    #include <wchar.h>
	    FILE *open_wmemstream(wchar_t **restrict BUF,
		size_t *restrict SIZE);

DESCRIPTION
       `open_memstream' creates a seekable, byte-oriented `FILE'  stream  that
       wraps  an arbitrary-length buffer, created as if by `malloc'.  The cur‐
       rent contents of *BUF are ignored; this implementation uses *SIZE as  a
       hint  of	 the  maximum size expected, but does not fail if the hint was
       wrong.  The parameters BUF and SIZE are later stored through  following
       any call to `fflush' or `fclose', set to the current address and usable
       size of the allocated string; although after  fflush,  the  pointer  is
       only  valid  until  another  stream  operation that results in a write.
       Behavior is undefined if the user alters either *BUF or *SIZE prior  to
       `fclose'.

	  `open_wmemstream'  is like `open_memstream' just with the associated
       stream being wide-oriented.  The size set in SIZE in subsequent	opera‐
       tions is the number of wide characters.

	  The  stream  is  write-only,	since  the user can directly read *BUF
       after a flush; see `fmemopen' for a way to wrap a string with  a	 read‐
       able  stream.   The user is responsible for calling `free' on the final
       *BUF after `fclose'.

	  Any time the stream is flushed, a NUL byte is written at the current
       position	 (but is not counted in the buffer length), so that the string
       is always NUL-terminated after at most *SIZE bytes (or wide  characters
       in case of `open_wmemstream').  However, data previously written beyond
       the current stream offset is not lost, and the NUL value written during
       a flush is restored to its previous value when seeking elsewhere in the
       string.

RETURNS
       The return value is an open FILE pointer on success.  On error,	`NULL'
       is  returned, and `errno' will be set to EINVAL if BUF or SIZE is NULL,
       ENOMEM if memory could not be allocated, or EMFILE if too many  streams
       are already open.

PORTABILITY
       POSIX.1-2008

	  Supporting OS subroutines required: `sbrk'.

SEE ALSO
       open_memstream  is  part of the library.	 The full documentation for is
       maintained as a Texinfo manual.	If info and are properly installed  at
       your site, the command

	      info

       will give you access to the complete manual.

NEWLIB				  April 2010		     OPEN_MEMSTREAM(3)
[top]

List of man pages available for Cygwin

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net