avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] [bugs #10420] sscanf(), If there is a decimal number foll


From: Theodore A. Roth
Subject: [avr-libc-dev] [bugs #10420] sscanf(), If there is a decimal number followed by the character '_' in the buffer, you can't get the the number.
Date: Fri, 17 Sep 2004 14:59:52 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

This mail is an automated notification from the bugs tracker
 of the project: AVR C Runtime Library.

/**************************************************************************/
[bugs #10420] Latest Modifications:

Changes by: 
                Theodore A. Roth <address@hidden>
'Date: 
                Fri 09/17/04 at 18:53 (US/Pacific)

            What     | Removed                   | Added
---------------------------------------------------------------------------
            Category | None                      | Library
         Assigned to | None                      | troth


------------------ Additional Follow-up Comments ----------------------------
I posted a potential fix to the dev mailing list. If the fix is acceptable, 
I'll commit it and close out this bug.

Thank you for supplying a concise example demostrating the problem. That made 
finding the problem trivial.






/**************************************************************************/
[bugs #10420] Full Item Snapshot:

URL: <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=10420>
Project: AVR C Runtime Library
Submitted by: 0
On: Fri 09/17/04 at 03:32

Category:  Library
Severity:  5 - Average
Item Group:  None
Resolution:  None
Privacy:  Public
Assigned to:  troth
Originator Email:  address@hidden
Status:  Open


Summary:  sscanf(),  If there is a decimal number followed by the character '_' 
 in the buffer, you can't get the the number. 

Original Submission:  I think there may be some troubles with the function 
sscanf(),

Lets have a look at the following example:

void mc(void)
{
    char buf[64] = "<1/dr_2_600";
    int addr,port,speed;

    sscanf(buf,"<%d/dr_%d_%d",&addr,&port,&speed);
    printf("addr=%d,port=%d,speed=%dn",addr,port,speed);
    return;
}

The expecting results are: addr=1, port=2,speed=600.
However,the actual results are: addr=1,port=28600, and 'speed' gets a invalid 
value.







Follow-up Comments
------------------


-------------------------------------------------------
Date: Fri 09/17/04 at 18:53         By: Theodore A. Roth <troth>
I posted a potential fix to the dev mailing list. If the fix is acceptable, 
I'll commit it and close out this bug.

Thank you for supplying a concise example demostrating the problem. That made 
finding the problem trivial.












For detailed info, follow this link:
<http://savannah.nongnu.org/bugs/?func=detailitem&item_id=10420>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]