r/cpp • • 8m ago

notweerdmonk / notweerdmonk.github.io

https://notweerdmonk.github.io/technical/istream_pitfalls/

I recently wrote an article about formatted extraction using input streams in C++.

1 Upvotes

1 comment sorted by

•

u/fortsnek274 0m ago

Or a better title: How to parse an integer properly

Because, yes, I noticed that too. A bunch of string to int routines leave junk in the input. So it's not really "the whole string to int", it's more "consume int".

Same with std::stoi.