|  | ||
| 
 | 
 char *fgets( char *s, int n, FILE *fp ) 
 char *s; /* character buffer */ int n; /* maximum length */ FILE *fp; /* open input stream */ 
 | 
 | 
| Synopsis | #include "stdio.h" 
 The fgets function reads a string from stream fp , and stores it into the character buffer pointed to by s . fgets reads until either a newline or n - 1 characters are encountered; the string is guaranteed to be null-terminated. 
 | 
 | 
| Parameters | s is the address of a character buffer, at least n bytes in length. fp is a stream pointer, open for input. 
 | 
 | 
| Return Value | fgets returns NULL (0L) if an error occurs or end-of-file is encountered before any characters have been read; otherwise, fgets returns s. 
 | 
 | 
| See Also | 
 | |
| 
 | 
 |