From: "Bill McEnaney" <bill@rkirkpat.net>
To: jon@jonshouse.co.uk, gcc-help@gcc.gnu.org
Subject: Re: sscanf trouble
Date: Tue, 25 Jan 2011 18:18:00 -0000 [thread overview]
Message-ID: <20110125181802.CE9EB7180B@saratoga.rkirkpat.net> (raw)
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
next reply other threads:[~2011-01-25 18:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-25 18:18 Bill McEnaney [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-01-25 19:57 Jonathan Andrews
2011-01-25 11:08 Jonathan Andrews
2011-01-25 12:18 ` Jonathan Wakely
2011-01-25 12:21 ` Adam Stein
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=20110125181802.CE9EB7180B@saratoga.rkirkpat.net \
--to=bill@rkirkpat.net \
--cc=gcc-help@gcc.gnu.org \
--cc=jon@jonshouse.co.uk \
/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).