Re: sscanf trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Why not replace the "=" with another character before you call sscanf?

Cheers,
Bill
Jon wrote:

> 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
> 
> 
> 
> 
> 

________________________________________________________________
Please visit a saintly hero:
http://www.jakemoore.org


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux