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

  1. @node fgets, stdio
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <stdio.h>
  6.  
  7. char *fgets(char *buffer, int maxlength, FILE *file);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. This function reads as much of a line from a file as possible, stopping
  13. when the buffer is full (@var{maxlength}-1 characters), an end-of-line
  14. is detected, or @code{EOF} or an error is detected.  It then stores a
  15. @code{NULL} to terminate the string.
  16.  
  17. @subheading Return Value
  18.  
  19. The address of the buffer is returned on success, if @code{EOF} is
  20. encountered before any characters are stored, or if an error is
  21. detected, @code{NULL} is returned instead. 
  22.  
  23. @subheading Example
  24.  
  25. @example
  26. char buf[100];
  27. while (fgets(buf, 100, stdin))
  28.   fputs(buf, stdout);
  29. @end example
  30.  
  31.