Archived

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

Moe

A question about file I/O...

Recommended Posts

Moe    1256
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
Darkor    134
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
a person    118
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
Tonic151    128
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   
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