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.
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster