This unit covers methods of working with files and a data structure for data storage in C programming. It explains that data stored in variables is lost when the program exits unless saved to a file. C handles files as sequential streams of bytes, with each file ending either with an end-of-file marker or a specified byte number. C supports binary files and text files, which differ in storage format. Text files store data as text, potentially with character translations (e.g., newline to carriage return), while binary files store data in the same format as in memory, making them more efficient for numeric values.
Disk I/O in C uses library functions defined by the ANSI standard and originally written for UNIX. There are two types of file systems: buffered and unbuffered. This unit will first cover buffered file functions and then unbuffered file functions.
Objectives:
After going through this unit you will be able to: