Stroustrup, section 20.3.15, page 598
The getline() function reads a line terminated by eol into its
string, expanding the string as needed to hold the line. If no eol
argument is provided, a newline '\n' is used as the delimiter. The line
terminator is removed from the stream but not entered into string.
where string = 2nd argument, eol = 3rd argument
now my point is when you give '\0' (its called null or NULL ?) as 3rd
argument which is not present in the input stream, what will be its
behavior ?
(1) will getline() keep on looking for it till its reaches EOF (End of
File) and read whole file into the string
(2) If I give anything which is not present in the input e.g. '#' will it
behave the same ?
Yes to question 1 (if there are no null characters in the file), and
yes to question 2. std::getline is agnostic towards its third
argument. It keeps reading characters from the input stream until it
finds the third argument, drops that character, and puts the read
characters (except for the delimiter) into the output argument
string.
Also, IIRC if it reaches EOF before encountering its third argument,
then if it has read at least one character before EOF into the output
string, then it marks the EOF bit on the input stream, but does not
mark the fail bit nor the bad bit. If it read 0 characters into the
output string and it encounters EOF, then it marks the EOF bit and the
fail bit (but not the bad bit) on the input stream.