1.

Mention the methods of opening files within C++. Discuss anyone.

Answer»

The methods of opening file within C++ program

  • Opening a file using constructor.
  • Opening a file using member function open() of the class Opening a file using constructor.

The syntax for opening file for output purpose only is ofstream obj(“filename”);
Example:
ofstream out(“results.dat”);



Discussion

No Comment Found

Related InterviewSolutions