Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: %n conversion in sscanf/VC++ 6-solved

Reply
Thread Tools

Re: %n conversion in sscanf/VC++ 6-solved

 
 
Anonymous
Guest
Posts: n/a
 
      10-30-2003
Anonymous wrote:
> The following code does not behave as I expect
> 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"
> 01234567890123456789012345678901234567890123456789 0
> 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 final %n in the control string is not reached, since there is no
whitespace at the end of the string s. Therefore, no assignment is made
to i, and the value there was left over from a previous assignment.

> http://www.velocityreviews.com/forums/(E-Mail Removed) (remove caps to get e-mail)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PSD to XHTML Conversion Services and PSD to HTML CSS ConversionServices, PSD to Joomla, Drupal, Wordpress Conversion xhtml champs Python 0 06-21-2011 11:59 AM
PSD to XHTML Conversion Services and PSD to HTML CSS ConversionServices, PSD to Joomla, Drupal, Wordpress Conversion PSD to XHTML Conversion Services and PSD to HTML CSS Conversion Services, PSD to Joomla, Drupal, Wor VHDL 0 04-25-2011 06:43 AM
conversion operator and conversion ctor subramanian100in@yahoo.com, India C++ 2 09-15-2009 12:46 PM
Date conversion problem with OE importing saroxonline76@vodafone.it Firefox 0 07-12-2005 07:38 PM
Framework 1.0 to 1.1 conversion Luc Bisson ASP .Net 2 11-19-2003 02:40 AM



Advertisments