

#include <stdio.h> void setbuf(FILE *stream, char *buf);
setbuf controls buffering for the specified stream on
operating systems that support user-defined buffers. setbuf is
similar to the setvbuf function. If buf is not
NULL, then the values _IOFBF and BUFSIZE are used for
setvbuf's mode and size arguments. If buf is
NULL, then the value _IONBF is used for setvbuf's
mode argument.
For FILE pointers that reference HFS files or sockets, you can use
setbuf to change the buffering mode or location. If
you do not use setbuf,
the default buffer size for HFS files and sockets is 1008
bytes. setbuf has no effect for any other kind of file. A call to
setbuf is permitted only as the first operation following the
opening of a file.
setbuf has no return value.
#include <stdio.h>
main()
{
char input[32];
setbuf(stdout, NULL); /* Try to prevent buffering of stdout. */
printf("Please enter your first name:");
fflush(stdout); /* Try to force output to terminal. */
gets(input);
printf("Thanks %s. It's been a pleasure.n",input);
}
setvbuf
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.