Next: setvbuf, Previous: setbuffer, Up: Stdio [Contents][Index]

### 4.57 `setlinebuf`—specify line buffering for a file or stream

Synopsis

    #include <stdio.h>
    void setlinebuf(FILE *fp);

Description
`setlinebuf` specifies that output to the file or stream identified by fp should be line buffered. This causes the file or stream to pass on output to the host system at every newline, as well as when the buffer is full, or when an input operation intervenes.

Warnings
You may only use `setlinebuf` before performing any file operation other than opening the file.

Returns
`setlinebuf` returns as per setvbuf.

Portability
This function comes from BSD not ANSI or POSIX.

Supporting OS subroutines required: `close`, `fstat`, `isatty`, `lseek`, `read`, `sbrk`, `write`.