fopen or fstream?

So I am pretty new at C++, I know the basics and stuff, however I would like to begin to learn files, however, I am not quite sure what it is I should learn.

I see there is fopen and fstream (ifstring and ofstring, if I remember correctly) for some kind of file handling, but I am wondering, what is the difference, and which should I learn first?
Hi!

The "fopen" came from C (because of compatibility) but you can use in C++ too. It is advised that in C++ you should use the fstream.

Here is a reference:
http://www.cplusplus.com/reference/iostream/

To focus file stream:
http://www.cplusplus.com/reference/iostream/fstream/

Examples:
http://www.codersource.net/cpp_file_io.html


Here is a tutorial on file streams: http://www.cplusplus.com/doc/tutorial/files/
which should I learn first?
If you are using C++ you don't need to learn the C FILE stuff
Topic archived. No new replies allowed.