Read characters from a stream into a string.
Synopsis
Declared in <bslstl_string.h>
template<
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
std::basic_istream<CHAR_TYPE, CHAR_TRAITS>&
getline(
std::basic_istream<CHAR_TYPE, CHAR_TRAITS>& is,
basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& str,
CHAR_TYPE delim);
Description
Replace the contents of the specified str string by extracting characters from the specified is stream until the specified delim character is extracted, and return is. The delim character is removed from the input stream but is not appended to str. If an eof is detected before delim, then the characters up to the eof are put into str and is.eof() becomes true. If is.good() is false on entry, then do nothing, otherwise if no characters are extracted (e.g., because because the stream is at eof), str will become empty and is.fail() will become true.
Return Value
reference to the input stream is
Parameters
Name |
Description |
is |
input stream |
str |
string to read into or parse |
delim |
delimiter character ending the extraction |
Created with MrDocs