Archived

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

MetroidHunter

File reading question

Recommended Posts

I think what you are looking for is fscanf.

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

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_stream_i.2f.o.asp

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