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: Joerg Wunsch
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: Sun, 19 Sep 2004 17:16:23 -0400
User-agent: Mozilla/5.0 Galeon/1.2.13 (X11; FreeBSD i386; U;) Gecko/0

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

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

Changes by: 
                Joerg Wunsch <address@hidden>
'Date: 
                Sun 09/19/04 at 21:10 (Europe/Berlin)

            What     | Removed                   | Added
---------------------------------------------------------------------------
          Resolution | None                      | Fixed
              Status | Open                      | Closed


------------------ Additional Follow-up Comments ----------------------------
Fixed in both, HEAD and avr-libc-1_0-branch.

Tbanks to Ted for his good analysis of the problem!






/**************************************************************************/
[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:  Fixed
Privacy:  Public
Assigned to:  troth
Originator Email:  address@hidden
Status:  Closed


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: Sun 09/19/04 at 21:10         By: Joerg Wunsch <joerg_wunsch>
Fixed in both, HEAD and avr-libc-1_0-branch.

Tbanks to Ted for his good analysis of the problem!

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