File handling in C is used to store data permanently on secondary storage (files).
C provides file handling functions through the stdio.h library.
Text Files
Binary Files
A file is accessed using a FILE pointer
| Mode | Description |
|---|---|
r | Read |
w | Write |
a | Append |
r+ | Read and write |
w+ | Write and read |
a+ | Append and read |
Checks end of file.
Permanent data storage
Data sharing between programs
Large data handling
File handling uses FILE pointer
fopen() opens a file
fclose() closes a file
Read and write using file functions
Supports text and binary files
Take quizzes related to this topic and see where you stand!
Start Quiz Now