Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

getline

Make sure you didn't use cin >> str. before calling the function. If you use cin >> str and then want to use getline(cin, str), you must call cin.ignore() before.

string str;
cin >> str;
cin.ignore(); // ignores 
 that cin >> str has lefted (if user pressed enter key)
getline(cin, str);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #getline
ADD COMMENT
Topic
Name
8+7 =