setvbuf---specify file or stream buffering
#include <stdio.h> int setvbuf(FILE *fp, char *buf, int mode, size_t size);
setvbuf to specify what kind of buffering you want for the
file or stream identified by fp, by using one of the following
stdio.h) as the mode argument:
Use the size argument to specify how large a buffer you wish. You
can supply the buffer itself, if you wish, by passing a pointer to a
suitable area of memory as buf. Otherwise, you may pass
as the buf argument, and
setvbuf will allocate the buffer.
You may only use
setvbuf before performing any file operation other
than opening the file.
If you supply a non-null buf, you must ensure that the associated storage continues to be available until you close the stream identified by fp.
0 result indicates success,
EOF failure (invalid mode or
size can cause failure).
Both ANSI C and the System V Interface Definition (Issue 2) require
setvbuf. However, they differ on the meaning of a
pointer: the SVID issue 2 specification says that a
pointer requests unbuffered output. For maximum portability, avoid
NULL buffer pointers.
Both specifications describe the result on failure only as a nonzero value.
Supporting OS subroutines required:
Go to the first, previous, next, last section, table of contents.