Files in C
Generally, a file is used to store user data in a computer. In other words, computer stores the data using files. we can define a file as follows...
File is a collection of data that stored on secondary memory like haddisk of a computer.
C programming language supports two types of files and they are as follows...
- Text Files (or) ASCII Files
- Binary Files
Text File (or) ASCII File - The file that contains ASCII codes of data like digits, alphabets and symbols is called text file (or) ASCII file.
Binary File - The file that contains data in the form of bytes (0's and 1's) is called as binary file. Generally, the binary files are compiled version of text files.
File Operations in C
The following are the operations performed on files in c programming langauge...
- Creating (or) Opening a file
- Reading data from a file
- Writing data into a file
- Closing a file
All the above operations are performed using file handling functions available in C. We discuss file handling functions in the next topic.