This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12437] New: scanf behavior differs from WG14/N1256 Committee Draft â Septermber 7, 2007


http://sourceware.org/bugzilla/show_bug.cgi?id=12437

           Summary: scanf behavior differs from WG14/N1256 Committee Draft
                    â Septermber 7, 2007
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: hjl.tools@gmail.com


Page 300 in

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

says "100e" shouldn't match "%f". But I got

[hjl@gnu-6 tmp]$ cat s.c
#include <stdio.h>

int main()
{
  int count;
  float quant;
  char buf[100];
  count = fscanf(stdin, "%f%s", &quant, buf);
  printf ("quant = %lf\n",quant );
  printf ("count = %d\n", count);
  printf ("string = %s\n", buf);
  return 0;
}
[hjl@gnu-6 tmp]$ gcc s.c
[hjl@gnu-6 tmp]$ cat x.input 
100ergs of energy
[hjl@gnu-6 tmp]$ ./a.out  < x.input 
quant = 100.000000
count = 2
string = rgs
[hjl@gnu-6 tmp]$ 

I was told that Windows and MacOS behave the same as glibc.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]