%n conversion in sscanf/VC++ 6
From: Anonymous (nospam_at_noISP.com)
Date: 10/30/03
- Next message: Gene Wirchenko: "Re: [OT] Re: to guru : strange C++ operator behaviour"
- Previous message: Will Oram: "Char Error"
- Next in thread: Anonymous: "Re: %n conversion in sscanf/VC++ 6-solved"
- Reply: Anonymous: "Re: %n conversion in sscanf/VC++ 6-solved"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 01:16:27 GMT
The following code does not behave as I expect, and I cannot understand
why not.
int i1,i2,i0; double x,y,z; char s[100];
k=sscanf(s,"%n%le %n%le %n%le %n",&i0,&x,&i1,&y,&i2,&z,&i);
When s=" 1.0000000E+06 1.0000000E+04 0.0000000E+00"
012345678901234567890123456789012345678901234567890
0 1 2 3 4 5
execution of the sscanf produces the results
i0=0
i1=21
i2=38
k=3
x=1e6, y=1e4, z=0
all as expected, but i=17, when I expect 51 (the total number of
characters read in this sscanf.
This is being run under Windows XP, Visual C++ 6 sp5.
sherNOwoodSPAM@computer.org (remove caps to get e-mail)
- Next message: Gene Wirchenko: "Re: [OT] Re: to guru : strange C++ operator behaviour"
- Previous message: Will Oram: "Char Error"
- Next in thread: Anonymous: "Re: %n conversion in sscanf/VC++ 6-solved"
- Reply: Anonymous: "Re: %n conversion in sscanf/VC++ 6-solved"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|