The function vsscanf(LIBDEF_ConstStringPtr ps, LIBDEF_ConstStringPtr format, va_list args) in the scanf.c library always fails.
Input:
int x;
int result;
result=sscanf("123","%d",&x);
result always returns 0 and x never has the value 123.
This is because:
if (*s++ == *format++) { /*lint !e931 the expression is safe */
in the function vsscanf line can never be true. The code then jumps to inputFailure
Why would the input string be compared against the format string? It doesn't seem to make any sense.
已解决! 转到解答。
First please always mention what CPU/derivative you are targeting, this board is for so different chips like a RS08 (does not have a stack) up to a Coldfire V1 (32 bit registers).
I'm guessing that there must be something wrong with your setup, for example not enought stack space, using the a library which is incompatible with the provided options, issues with the memory layout, ....
The line you are quoting is to match direct input (think of sscanf("Hello", "Hello")), so the code apparently did not parse the % first.
I would suggest:
- start with a fresh, wizard generated project.
- make sure you have enough stack space
- copy/paste your simple sscanf code into it
- make sure it compiles without warnings (implicit parameter declarations)
- if that fails, zip it and post the project it here.
Daniel
BTW: IDE 5.9 refers to the editor/development environment. Really does not narrow the possibilities down.
First please always mention what CPU/derivative you are targeting, this board is for so different chips like a RS08 (does not have a stack) up to a Coldfire V1 (32 bit registers).
I'm guessing that there must be something wrong with your setup, for example not enought stack space, using the a library which is incompatible with the provided options, issues with the memory layout, ....
The line you are quoting is to match direct input (think of sscanf("Hello", "Hello")), so the code apparently did not parse the % first.
I would suggest:
- start with a fresh, wizard generated project.
- make sure you have enough stack space
- copy/paste your simple sscanf code into it
- make sure it compiles without warnings (implicit parameter declarations)
- if that fails, zip it and post the project it here.
Daniel
BTW: IDE 5.9 refers to the editor/development environment. Really does not narrow the possibilities down.