A file represents a sequence of bytes on the disk where a group of related data is stored. File is created for permanent storage of data. It is a ready made structure.
In C language, we use a structure pointer of file type to declare a file.
FILE *fp;
Write (w) mode and Append (a) mode, while opening a file are almost the same. Both are used to write in a file. In both the modes, new file is created if it doesn't exists already.
The only difference they have is, when you open a file in the write mode, the file is reset, resulting in deletion of any data already present in the file. While in append mode this will not happen. Append mode is used to append or add data to the existing data of file(if any. Hence, when you open a file in Append(a) mode, the cursor is positioned at the end of the present data in the file.
A Binary file is similar to a text file, but it contains only large numerical data. The Opening modes are mentioned in the table for opening modes above
A file represents a sequence of bytes on the disk where a group of related data is stored.
In C language, we use a structure pointer of file type to declare a file.
General Syntax
filename is the name of the file to be opened and mode specifies the purpose of opening the file.
General Syntax