home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / ansi / stdio / setvbuf.txh < prev    next >
Encoding:
Text File  |  1995-07-10  |  1.1 KB  |  40 lines

  1. @node setvbuf, stdio
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <stdio.h>
  6.  
  7. int setvbuf(FILE *file, char *buffer, int type, int length);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. This function modifies the buffering characteristics of @var{file}. 
  13. First, if the file already has a buffer, it is freed.  If there was any
  14. pending data in it, it is lost, so this function should only be used
  15. immediately after a call to @code{fopen}.
  16.  
  17. If the @var{type} is @code{_IONBF}, the @var{buffer} and @var{length}
  18. are ignored and the file is set to unbuffered mode. 
  19.  
  20. If the @var{type} is @code{_IOLBF} or @code{_IOFBF}, then the file is
  21. set to line or fully buffered, respectively.  If @var{buffer} is
  22. @code{NULL}, a buffer of size @var{size} is created and used as the
  23. buffer.  If @var{buffer} is non-@code{NULL}, it must point to a buffer
  24. of at least size @var{size} and will be used as the buffer. 
  25.  
  26. @xref{setbuf}.
  27. @xref{setbuffer}.
  28. @xref{setlinebuf}.
  29.  
  30. @subheading Return Value
  31.  
  32. Zero on success, nonzero on failure.
  33.  
  34. @subheading Example
  35.  
  36. @example
  37. setbuf(stderr, NULL, _IOLBF, 1000);
  38. @end example
  39.  
  40.