Get string from stream.
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 the end-of-file is reached, whichever happens first.
- Parameters
-
str | Pointer to an array of chars where the string read is copied. |
num | Maximum number of characters to be copied into str (including the terminating null-character). |
stream | Pointer to a FILE object that identifies the stream to be closed. |
- Returns
- On success, the function returns str. If the end-of-file is encountered while attempting to read a character, the eof indicator is set. If this happens before any characters could be read, the pointer returned is a null pointer.