This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sscanf trouble


Hi people.

Can anyone help with what should be a simple problem. I have some text
in the following form. Its a temperature reading from a wireless sensor,
the format is T<sensor number>=<float ish> <TAB><TAB><Two digit ascii
checksum>

T1=18.0<TAB><TAB>XX\n\r

Some examples:

        T1=-11.5        EA
        T1=24.0         9D

Im trying to convert this string into a sensor ID, a floating point
reading and a checksum as 3 variables using sscanf

sscanf(line,"T%d=%f\t\t%X",&sensorid,&temperature,&checksum);

No amount of variations on a theme seem to give me an entire decode
here, seems the equals seems to screw things up.  Anyone any ideas how I
can make this work?

Thanks for any advice,
Jon





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]