sscanf %c - what is return value if empty

13 Apr 2011

I don't know what value gets chr if there is no char in the search string

int int1; char chr; sscanf("123A", "%d%c", &int1, &chr);

sscanf("123", "%d%c", &int1, &chr); pc.printf("char %c\n\r", chr); prints "har "

I would like to compare chr against some value to know if chr is empty ...

Best regards, Peter

13 Apr 2011

Check the return value of sscanf. It returns number of format fields parsed.