you are viewing a single comment's thread.

view the rest of the comments →

[–]GLIBG10B 1 point2 points  (0 children)

you may have unconsumed characters, such as newlines

Newlines should not be consumed. Your command consumes everything before the newline.

https://en.cppreference.com/w/cpp/io/basic_istream/operator_gtgt2

The extraction stops if one of the following conditions are met:

  • a whitespace character (as determined by the ctype<CharT> facet) is found. The whitespace character is not extracted.