So i wrote this in C, so sscanf scans in s but then discards it, then scans in d and stores it. So if the input is “Hello 007”, Hello is scanned but discarded and 007 is stored in d.
static void cmd_test(const char *s)
{
int d = maxdepth;
sscanf(s, "%*s%d", &d);
}
So, my question is how can I do the same thing but in C++? possibly using stringstream?
1 Answer