[Solved] Why sscanf is not handling or ignoring spaces in c++?


Why sscanf is not handling or ignoring spaces in c++?

How else should sscanf seperate words/tokens?
From its documentation:

[“%s”] matches a sequence of non-whitespace characters (a string)

I don’t think you can handle this with sscanf or in a one-liner at all.
You could do this with std::string::find_first_of and std::string::substr

Edit:

std::regex_match might be the most flexible and readable way if you’re used to regular expressions.

solved Why sscanf is not handling or ignoring spaces in c++?