programming.nbk: Home | Index | Next Page: fopen() | Previous Page: fgetc()
Reads characters from stream and stores them as a C string into str until (num-1) characters have been read or either a newline or a the End-of-File is reached, whichever comes first. A newline character makes fgets stop reading, but it is considered a valid character and therefore it is included in the string copied to str. A null character is automatically appended in str after the characters read to signal the end of the C string.
On success, the function returns the same str parameter.
If the End-of-File is encountered and no characters have been read, the contents of str remain unchanged and a null pointer is returned.
If an error occurs, a null pointer is returned.
Use either ferror or feof to check whether an error happened or the End-of-File was reached.
programming.nbk: Home | Index | Next Page: fopen() | Previous Page: fgetc()
Notebook exported on Monday, 7 July 2008, 18:56:06 PM Eastern Daylight Time