-

Changes

Jump to: navigation, search

Functions HI-TECH C SETVBUF

1,482 bytes added, 23:33, 31 July 2017
Created page with "<strong>SETVBUF, SETBUF</strong> ==SYNOPSIS== #include <stdio.h> int setvbuf(FILE * stream, char * buf, int mode, size_t size); void setbuf(FILE * stream, char * b..."
<strong>SETVBUF, SETBUF</strong>
==SYNOPSIS==

#include <stdio.h>

int setvbuf(FILE * stream, char * buf, int mode, size_t size);
void setbuf(FILE * stream, char * buf)


==DESCRIPTION==
The <strong>setvbuf</strong>() function allows the buffering behaviour
of a STDIO stream to be altered. It supersedes the
function <strong>setbuf</strong>() which is retained for backwards compatibility. The arguments to <strong>setvbuf</strong>() are as follows:
stream designates the STDIO stream to be affected; buf
is a pointer to a buffer which will be used for all
subsequent I/O operations on this stream. If buf is
null, then the routine will allocate a buffer from the
heap if necessary, of size BUFSIZ as defined in
<stdio.h>. mode may take the values _IONBF, to turn
buffering off completely, _IOFBF, for full buffering,
or _IOLBF for line buffering. Full buffering means that
the associated buffer will only be flushed when full,
while line buffering means that the buffer will be
flushed at the end of each line or when input is
requested from another STDIO stream. size is the size
of the buffer supplied. For example:

setvbuf(stdout, my_buf, _IOLBF, sizeof my_buf);

If a buffer is supplied by the caller, that buffer will
remain associated with that stream even over <strong>fclose</strong>(),
<strong>fopen</strong>() calls until another <strong>setvbuf</strong>() changes it.


==SEE ALSO==

fopen, freopen, fclose

Navigation menu