HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

s
setlinebuf(3C) setlinebuf(3C)
NAME
setlinebuf() - assign buffering to a stream
SYNOPSIS
#include <stdio.h>
void setlinebuf(
FILE *
stream
);
Parameters
stream Pointer to the input/output stream.
buffer Pointer to a character array.
size The size of the buffer to be used.
DESCRIPTION
To use this function, compile with the option
-I/usr/include/ep
and link in the libcext library by
specifying
-lcext, for example:
cc -I/usr/include/ep [flag]... cfile[...] -lcext [...]
The setlinebuf() function is used to change stdout or stderr from block-buffered or unbuffered to
line-buffered. Unlike the setbuf() function, the setlinebuf() function can be used any time the file
descriptor is active.
A buffer is normally obtained from the malloc() function at the time of the first
getc() or putc()
function on the file, except that the standard error stream, stderr, is normally not buffered.
Output streams directed to terminals are always either line-buffered or unbuffered.
Notes
A common source of error is allocating buffer space as an automatic variable in a code block and then failing
to close the stream in the same block.
RETURN VALUES
The
setlinebuf() function do not return any value.
WARNINGS
Users of setlinebuf() should note that the libcext library will not be available in future releases of
HP-UX. However this function is available as part of the C library libc.
AUTHOR
setlinebuf() function was developed by HP.
SEE ALSO
fopen(3S), fread(3S), getc(3S), getwc(3C), malloc(3C), putc(3S), putwc(3C), setbuf(3S).
HP-UX 11i Version 2: December 2007 Update − 1 − Hewlett-Packard Company 403