Hi Ricardo,
I don't use CodeWarrior so I can't check this for myself, but most libraries I have use need a format specifier like this:
%[*][width]type
In the line:
Code:if(sscanf( (char8*)buffer[],"relay%1=on",&(*info))==1)
it doesn't look like you have specified the type, should it be %1d? Maybe CodeWarrior assumes d if you omit a type specifier, but you should probably be more defensive than that for a command parser.
Also, sscanf returns the number of fields successfully converted, your code will always stop at the first line because the first field will always be converted. You could do this instead:
Code:char cmd[4] = {0, 0, 0, 0};if (sscanf((char8*)buffer[], "relay%1d=%3s", &(*info), cmd) == 2){ if (strcmp(cmd, "on")) { return(command_1); } else if (strcmp(cmd, "off")) { return(command_2); }}
Hope this helps,
Paul.
(Edit: The stupid forum software insists on inserting childish smiley icons, I apologise for that!)
Message Edited by mccp on
2007-05-08 09:54 AM
--
Alban Edit: used SRC to remove childish smiley icons
Message Edited by Alban on
2007-05-08 01:59 PM