The std::basic_istream::getline is used to extract the characters from stream until end of line or the extracted character is the delimiting character. The delimiting character is the new line character i.e ‘\n’. This function will also stop extracting characters if the end-of-file is reached if input is taken using file.
basic_istream& getline (char_type* a, streamsize n ) basic_istream& getline (char_type* a, streamsize n, char_type delim);
Parameters: It accepts the following parameters:
- N: It represent maximum number of character pointed by a.
- a: It is the pointer to string to store the characters.
- stream: It is an explicit delimiting character.
Return Value: It returns the basic_istream object.
Below are the program to demonstrate basic_istream::getline():
123 aef 5h
GeeksforGeeks A Computer Science Portal For Geeks