file open mode : File Stream in C Programming
In this tutorial we are going to review all file opening modes in C Programming Language (File Handling).
Refer this article before : What is FILE Pointer ?
| Mode | Meaning | fopen Returns if FILE- | |
|---|---|---|---|
| Exists | Not Exists | ||
| r | Reading | - | NULL |
| w | Writing | Over write on Existing | Create New File |
| a | Append | - | Create New File |
| r+ | Reading + Writing | New data is written at the beginning overwriting existing data | Create New File |
| w+ | Reading + Writing | Over write on Existing | Create New File |
| a+ | Reading + Appending | New data is appended at the end of file | Create New File |
Explanation :
- File can be opened in basic 3 modes.
- Read Mode
- Write Mode
- Append Mode
- If File is mot present then New File can be created using Write and Append Mode.
- Generally we used to open following types of file in C -
- C Source File (.c)
- Text File (.txt)
- Data File (.dat)
- Writing on the file will overwrite previous content.

