snprintf

setvbuf

#include <stdio.h>int setvbuf(FILE *stream, char *buf, int mode, size_t size);

The setvbuf( ) function allows the programmer to specify a buffer, its size, and its mode for the specified stream. The character array pointed to by buf is used as the buffer for I/O operations on stream. The size of the buffer is set by size and mode determines how buffering will be handled. If buf is null, setvbuf( ) will allocate its own buffer.

In C99, stream and buf are qualified by restrict.

The legal values of mode are _IOFBF, _IONBF, and _IOLBF. These are defined in <stdio.h>. When mode is set to _IOFBF, full buffering will take place. If mode is _IOLBF, the stream will be line buffered. For output streams, this means that the buffer will be flushed each time a newline character is written. The buffer is also flushed when full. For input streams, input is buffered until a newline is read. If mode is _IONBF, no buffering takes place.

The setvbuf( ) function returns zero on success and nonzero on failure.

A related function is setbuf( ).




C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net