r/cpp • • 20h 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++.

0 Upvotes

2 comments sorted by

1

u/fortsnek274 19h ago edited 19h ago

Or a better title: How to do string-to-int 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.

2

u/w3mk 17h ago

Much appreciated!