This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
sscanf trouble
- From: Jonathan Andrews <jon at jonshouse dot co dot uk>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 25 Jan 2011 11:09:04 +0000
- Subject: sscanf trouble
- Reply-to: jon at jonshouse dot co dot uk
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