Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Precision with sscanf!

Status
Not open for further replies.

SchurliBurli

Automotive
Joined
Aug 20, 2003
Messages
6
Location
AT
Hello!

I have the following problem with the sscanf command.
The doubles of the following line should be read out:

S=' 1.000000E+00 G -3.374722E-05 2.751758E-05 1.076888E-03 8'

If i use the following command:

A=sscanf(S,'%f %c %f %f %f %f')'

I get:

A =

1.0000 71.0000 -0.0000 0.0000 0.0011 8.0000


My doubles get cut off. sscanf doesn't get all of the information.
If i use: A=sscanf(S,'%.16f %c %.16f %.16f %.16f %.16f')' i get nothing!
But if i use this syntax for sprintf, it works, why not with sscanf.

Does someone has a hint for me!

Thanks in advance!
Georg

 
Have you tried using e instead of f?
 
Hi!

Yes, I have! But the problem seems to be a option for display, because if i calculate with them, the result is o.k. So it is saved proper, but not displayed. Funny!

As long as the results are o.k, I do not mind!

Greets
 
For all, who have the same problem:
Look at the helpdesk. Seek for the format command. Thats the way how to change the display-accuracy!

Greets
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top