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

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

[avr-libc-dev] [bug #21382] vscanf problem with %s when a width is given


From: Lars Jonsson
Subject: [avr-libc-dev] [bug #21382] vscanf problem with %s when a width is given
Date: Sun, 21 Oct 2007 22:22:49 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)

URL:
  <http://savannah.nongnu.org/bugs/?21382>

                 Summary: vscanf problem with %s when a width is given
                 Project: AVR C Runtime Library
            Submitted by: lajon
            Submitted on: måndag 2007-10-22 den 00:22
                Category: Library
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: libc code
                  Status: None
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Looks like it consumes a character too much during a %s scan when a width is
given. In the example below the ',' can not be matched and res will be 0 (and
foo is not assigned).

#include <stdio.h>
int parse_test(const char * string)
{  
   volatile char foo = 0;
   int res = sscanf(string, "%*6s,%c", &foo); 
   printf("%d %c\n", res, foo);
   return res == 1 && foo == 'A';
} 

int main(int argc, char **argv)
{
    parse_test("$GPRMB,A");  
}




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?21382>

_______________________________________________
  Meddelandet skickades via/av Savannah
  http://savannah.nongnu.org/





reply via email to

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