From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28108 invoked by alias); 25 Jan 2011 18:18:10 -0000 Received: (qmail 28094 invoked by uid 22791); 25 Jan 2011 18:18:09 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from saratoga.rkirkpat.net (HELO saratoga.rkirkpat.net) (206.196.156.29) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Jan 2011 18:18:05 +0000 Received: by saratoga.rkirkpat.net (Postfix, from userid 33) id CE9EB7180B; Tue, 25 Jan 2011 11:18:02 -0700 (MST) From: "Bill McEnaney" To: jon@jonshouse.co.uk, gcc-help@gcc.gnu.org Subject: Re: sscanf trouble X-IPAddress: 67.242.202.73 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Message-Id: <20110125181802.CE9EB7180B@saratoga.rkirkpat.net> Date: Tue, 25 Jan 2011 18:18:00 -0000 X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg00365.txt.bz2 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= checksum> > > T1=18.0XX\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