I have some input file that looks like this:
asdfasfasfas....
asdfasdfasd....
asdfasdf....
asdfsadf...
I want to be able to read line by line the whole line, without skipping the blank lines in between. How can I do this? Each line has no white space in it, but if I simply read in and process as:
std::string line;
file >> line;
Foo(line);
Then it skips the second line and jumps straight to the second. I don’t want that to happen. How can I work around this?
You can use
getlineto read line by line, rather thanoperator>>that will skip the spaces.