I don’t understand why the code below fail :
char toto[54], titi[54]; //I already tried with allocations
sscanf_s(line, "%s-%s", &toto, &titi, sizeof(toto) + sizeof(titi));
or
sscanf_s(line, "%s-%s", &toto, &titi, sizeof(toto) + sizeof(titi));
My problem is only with strings (float, int, double etc. its ok) and I use Visual 2010.
Does anyone have an idea?
Thanks a lot in advance for your answer.
From the
sscanf_s()reference page:Meaning each buffer must be followed by its size:
Additionally,
-is not a whitespace character will not act as a terminator for"%s"format specifier so iflinecontainedhello-worldthen it would be read intototoandtitiwould not be assigned. To use-as a terminator use a scan set: