nephritiri
March 20th, 2008, 08:53 PM
hey guys...
im having some problems in reading strings from a file.
data from the file are the ff:
-10 1.5 0
i was able to read them, convert and save them in variables and write those values on the screen using this code:
sscanf( buff, " %f%f%f", &l1,&l2,&l3 )
printf("%f ", l1);
printf("%f ", l2);
printf("%f\n", l3);
however, the '-' sign is somehow truncated during the file reading
coz the output is:
10.000000 1.500000 0.000000
can someone help me?
thanks.
im having some problems in reading strings from a file.
data from the file are the ff:
-10 1.5 0
i was able to read them, convert and save them in variables and write those values on the screen using this code:
sscanf( buff, " %f%f%f", &l1,&l2,&l3 )
printf("%f ", l1);
printf("%f ", l2);
printf("%f\n", l3);
however, the '-' sign is somehow truncated during the file reading
coz the output is:
10.000000 1.500000 0.000000
can someone help me?
thanks.