Jump to content
  • Advertisement

Archived

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

SteveSweitzer

stdio better than fstream for file manip?

This topic is 5305 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''ve been reading through several file loading tutorials (for images and models) and everyone I''ve seen uses the stdio file functions for reading and writing to files (fopen, fread, etc). I was educated completely on C++ though and I''m used to using fstream (filestream.open(), filestream.read, etc). Every tutorial used objects, so they weren''t using stdio to be standard C compliant. As far as I can tell, stdio doesn''t really confer a coding advantage over fstream, but I was wondering if there was a performance difference (maybe smaller memory usage) or some other reason to explain stdio''s popularity. Granted, file loading performance isn''t a huge concern for the small 3D apps I''m writing as a beginner, but I''m just curious.

Share this post


Link to post
Share on other sites
Advertisement
Many older devs seem to use stdio cause that is what they know. It does work well, but so does fstream. Use what you know.

Share this post


Link to post
Share on other sites
Nor do I know of any performance reduction/increase from using stdio.Older games were all mainly written in C so they use stdio.If you are comfortable using fstream use it as you will work faster and much better too

Share this post


Link to post
Share on other sites
Thanks for the replies. I actually know stdio just as well as fstream; the function names and their uses are almost the exact same. It''s just with stdio you''re using functions and passing them a file pointer, and with fstream your running object functions. Arguably, using stdio is simpler than using fstream but I think that using the object based fstream is more appropriate in C++.

It''s good to know there''s no apparent advantage to using stdio though.

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!