• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
July 16, 2022 |6.6K Views
Create a File | CPP Program
Description
Discussion

In this video, we will see how to create a file in C++.

File handling in C++ includes the following:

1) Create a file
2) Naming a file
3) Opening a file
4) Writing data into the file
5) Reading data from the file
6) Closing a file

Here in this video we cover three different classes for file stream operations:

1) ifstream
2) ofstream
3) fstream

ifstream: It provides input operations. This class contains open() function with default input mode. Inherits the functions get(), getline(), read(), seekg() and tellg() functions from the ifstream.

ofstream: ofstream class provides output operations. This class contains open() function with default output mode. Inherits the functions put(), write(), seekp() and tellp() functions from the ostream.

fstream: fstream class provides support for simultaneous input and output operations.

C++ Program to Create a File: https://www.geeksforgeeks.org/c-program-to-create-a-file/

Read More