From: Jonathan Andrews <jon@jonshouse.co.uk>
To: gcc-help@gcc.gnu.org
Subject: sscanf trouble
Date: Tue, 25 Jan 2011 11:08:00 -0000 [thread overview]
Message-ID: <1295953744.24086.0.camel@jonspc> (raw)
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
next reply other threads:[~2011-01-25 11:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-25 11:08 Jonathan Andrews [this message]
2011-01-25 12:18 ` Jonathan Wakely
2011-01-25 12:21 ` Adam Stein
2011-01-25 18:18 Bill McEnaney
2011-01-25 19:57 Jonathan Andrews
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1295953744.24086.0.camel@jonspc \
--to=jon@jonshouse.co.uk \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).