fstreamfile-management

Modes in fstream referring to two different sets ios and fstream for the same thing(in my opinion)


What is the difference between these two lines in file management in C++?

fstream fin("project.csv",fstream::in); fstream fin("project.csv",ios::in);


Solution

  • Refer to the image for the hierarchy of classes in C++.

    Refer to image for hierarchy of classes in c++.

    Actually ios_base is the superclass which is inherited by ios class, which is inherited by istream and ostream and both of these are inherited by iostream which is later inherited by fstream, therefore ios::in or fstream::in are the same.