I'm parsing a string (a char*
) and I'm using sscanf
to parse numbers from the string into doubles, like so:
// char* expression;
double value = 0;
sscanf(expression, "%lf", &value);
This works great, but I would then like to continue parsing the string through conventional means. I need to know how many characters have been parsed by sscanf
so that I may resume my manual parsing from the new offset.
Obviously, the easiest way would be to somehow calculate the number of characters that sscanf
parses, but if there's no simple way to do that, I am open to alternative double parsing options. However, I'm currently using sscanf
because it's fast, simple, and readable. Either way, I just need a way to evaluate the double and continue parsing after it.