Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdio.h>
    int setvbuf( FILE *fp,
                 char *buf,
                 int mode,
                 size_t size );

Description:
    The setvbuf function can be used to associate a buffer with the file
    designated by fp.  If this function is used, it must be called after the
    file has been opened and before it has been read or written.  The
    argument mode determines how the file fp will be buffered, as follows:

    Mode     Meaning

_IOFBF
    causes input/output to be fully buffered.

_IOLBF
    causes output to be line buffered (the buffer will be flushed when a
    new-line character is written, when the buffer is full, or when input is
    requested.

_IONBF
    causes input/output to be completely unbuffered.

    If the argument buf is not NULL, the array to which it points will be
    used instead of an automatically allocated buffer.  The argument size
    specifies the size of the array.

Returns:
    The setvbuf function returns zero on success, or a non-zero value if an
    invalid value is given for mode or size.

Example:
    #include <stdio.h>
    #include <stdlib.h>

    void main()
    {
      char *buf;
      FILE *fp;

      fp = fopen( "file", "r" );
      buf = malloc( 1024 );
      setvbuf( fp, buf, _IOFBF, 1024 );
    }

Classification:
    ANSI

Systems:
    All, Netware

See Also:
    fopen, setbuf

See Also: setbuf

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