AnsweredAssumed Answered

Legacy sscanf function doesn’t work under MQX using %u.

Question asked by Juan Aguirre on Mar 5, 2010
Latest reply on Mar 13, 2010 by Juan Aguirre

Hello All,


I was trying to get the following to work :


//Local Variablesvolatile char input_string[]= "123456789012345678901234567890";volatile uint_16 i=0, number_sscanf=0;volatile uint_8 arg1=0, arg2=0, arg3=0;{..number_sscanf = sscanf (input_string, "%s %u %u %u",command_string1, &arg1, &arg2, &arg3);..}


I later found out doing research on this forum that:


a.  I have to use %i instead of %u

b.  I have to declare my arg variables uint_32 instead of uint_8

c.  I cannot use “volatile char input_string[] = …”, I have to declare it as “char input_string[] = …”


I found my answer here:


My questions:


1.  How come MQX does not support a legacy function fully like sscanf?


2.  The MQX sscanf function has limitations, so why isn’t it well documented somewhere?  I found inside io_scanf.c to see scanline.c for comments, but I couldn’t find the file.  (In contrast, the MSL_C_Reference.pdf included with Codewarrior Coldfire [when not using MQX] seems to conform to C99 and is well documented).


If I am wrong in anything above, please let me know.




(I am using Codewarrior 7.1.2 for Coldfire (MCF52259 target), MQX 3.5).