This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sscanf does not work properly

I started to use the sscanf function to parse commands from serial port and found out that it does not work as it must do. Example:

int i, j = 0x1234;
char c = '\0';
i = sscanf("anything", "%d%c", &j, &c);
After the function call:
i == 1,
j == 0,
c == 'a',
while there should have been:
i == 0,
j == 0x1234,
c == '\0'.

Obviously, I cannot detect some errors in the input with this 'non-ANSI' sscanf. Does anyone have any ideas how to solve the problem?

0