Jump to content
  • Advertisement


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


File reading question

This topic is 5834 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

You will gave to parse that one line.
Put your data on seperate lines instead or do it the "real" way; don''t save to textfile, instead save your struct.

Share this post

Link to post
Share on other sites
I think what you are looking for is fscanf.

Try starting on the Stream I/O page on MSDN.


Look for fscanf. You know when you use a printf and you want to format it as an int then a string then maybe a double and you go something like "%d, %s, %.2lf", someInt, someString, someFloat? Well fscanf will let you do the same thing but reading in from a file stream. So if you are reading in lines from a file you would open the file with fopen and then...

fscanf( stream, "%d %s %lf", &someInt, &someString, &someFloat );

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!