File in C Language
File in C Language
File handling in C enables us to create, update, read, and delete the files stored on the
local file system through our C program. The following operations can be performed on
a file.
Types of Files
1. Text files
2. Binary files
1. Text files
Open for append in binary mode. If the file does not exist, it will be
ab
Data is added to the end of the file. created.
Open for both reading and writing in If the file does not exist, fopen()
rb+
binary mode. returns NULL.
Open for both reading and appending in If the file does not exist, it will be
ab+
binary mode. created.
The fopen function works in the following way.
Syntax:
FILE *ptr;
Ptr=fopen(“url”,”mode”);