• Advertisement

Archived

This topic is now archived and is closed to further replies.

fscanf

This topic is 5302 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''d like to read floats (they are separated from comma) from a text file which contains also some characters that i want to skip like { } There is a way to skip those chars ?

Share this post


Link to post
Share on other sites
Advertisement
read the whole file then replace all "unwanted" characters with spaces...
then tokenize the string into pieces and use atof to convert

Share this post


Link to post
Share on other sites


say the format is...

{0.56,78.6,90.0}


then all u have to do is...

float float1, float2, float3;

fscanf(file, "{%f,%f,%f}", &float1, &float2, &float3);

Share this post


Link to post
Share on other sites

  • Advertisement