C++ File Input/Output

A file is a collection of data stored on a disk and the content within the file is referred to as its “data.” The computer reads the characters in the file with the help of ASCII code, where each character is mapped to a decimal number and then converted to binary for the computer to understand.

Large programs used for heavy applications rely on files for input and output, as well as for efficient and fast storage of data. Files are stored in non-volatile memory, which remains intact even after the system is shut down and can be retrieved again when the system is turned back on.

There are four basic operations that can be performed on files in C++:

  • Creating a File: A file can be created in any directory using the C++ language and with a selected name and type.
  • Opening a File: An existing file or a new file can be opened and different operations can be performed on it.
  • Closing a File: When the operations on the file are completed, it can be closed using the close function.
  • Reading/Writing to a File: After opening a file, its contents can be accessed, read, written, or updated.
Shubhajna Rai
Shubhajna Rai

A Civil Engineering Graduate interested to share valuable information with the aspirants.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in