Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>setvbuf() control stream buffering and buffer size</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
setvbuf()                Control Stream Buffering and Buffer Size

 #include   <stdio.h>

 int        setvbuf(stream,buf,type,size);
 FILE       *stream;                     Pointer to file structure
 char       *buf;                        User-allocated buffer
 int        type;                        Type of buffer:
 int        size;                        Size of buffer

    setvbuf() causes 'buf' to be used for I/O buffering instead of the
    automatically allocated buffer, thereby giving the user a way to
    control both buffering and buffer size for a given stream.  'stream'
    must refer to an open file.  If 'buf' is NULL, the stream is
    unbuffered; otherwise, it is fully buffered.

    If 'stream' is buffered, 'type' must be set to one of the following:

        _IONBF      No buffer is used, regardless of arguments 'buf' or
                    'size'
        _IOFBUF     Full buffering (unless 'buf' is NULL). Use 'buf' as
                    the buffer and 'size' as the buffer size
        _IOLBUF     Same as _IOFBF

     If 'type' is _IOFBF or _IOLBF, 'size' is used as the size of 'buf'.
    'size' must be greater than 0 and less than the maximum integer size.
    If _IONBF is specified, then the stream is unbuffered and 'size' and
    'buf' are ignored.

    Returns:    Zero if successful.  Non-zero is returned if an illegal
                type or buffer size is specified.

See Also: setbuf() fflush() fopen() fclose()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson