Jump to content
  • Advertisement

Archived

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

Moe

A question about file I/O...

This topic is 5895 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 am wondering what is the most commonly used method for file input/output for windows based text/binary files? I have seen people use ''FILE'', and I have seen people use fstream. Is there much of a difference between the two in terms of performance/ease of use? Moe''s site

Share this post


Link to post
Share on other sites
Advertisement
I don''t know about perfomance but I''d go with fstream for ease of use.

Firstly, who doesn''t know how to use << and >>? What''s more, you can overload the << and >> operators for your classes.

Share this post


Link to post
Share on other sites
using the standard c funtions is easy as well. i mean who dont know how to use fread()/fwrite()? whats more you can wrap the functions for your use.

Share this post


Link to post
Share on other sites
Basiclly i would say use fstream if your going to be extracing data into a C++ String..

string temp;

User fread/fwrite if your going to be extracting data into a C Character string

char temp[30];

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
C++ streams are easier and safer. Typesafety is one of the greatest things you can have.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!