Using stringstream instead of `sscanf` to parse a fixed-format string
- by John Dibling
I would like to use the facilities provided by stringstream to extract values from a fixed-format string as a type-safe alternative to sscanf. How can I do this?
Consider the following specific use case. I have a std::string in the following fixed format:
YYYYMMDDHHMMSSmmm
Where:
YYYY = 4 digits representing the year
MM = 2 digits…