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
I recently wrote an article about formatted extraction using input streams in C++.
1
u/fortsnek274 2d ago edited 2d 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.1
u/13steinj 8h ago
Do people actually use the input/output stream API in serious applications (post...idk, 2016)? Legitimate ask.
In the best case scenario, I have always just worked around it or wrapped it.