I am trying to extract the first two characters from a string using getline, is this possible or how can I do the extraction?
I am trying to extract the first two characters from a string using getline, is this possible or how can I do the extraction?
Last edited by robasc; 10-20-2006 at 02:08 AM. Reason: title error
Can't you use getline to get the string and then just access the first two characters by saying:
http://www.cppreference.com/cppstring/substr.htmlCode:stringName.substr(2);
Or, if you don't want to get the entire line from the stream, just call get() twice to get two characters. Is there a reason you think you need to use getline?