What is data files in C
Until
now we have been using the functions such as scanf and printf to read
and write data. These are console oriented I/O functions, which always use the
terminal (keyboard and screen) as the target place. This works fine as long as
the data is small. However, many real-life problems involve large volumes of
data and in such situations; the console oriented I/O operations pose two major
problems.
1.
It becomes cumbersome and time consuming to handle large
volumes of data through terminals.
2.
The entire data is lost when either the program is terminated
or the computer is turned off.
It is therefore necessary to have a more flexible approach where data can be stored on the disks and read whenever necessary, without destroying the data. This method employs the concept of file to store data. A file is a place on the disk where a group of related data is stored. Like most other languages, C supports a number of functions that have the ability to perform basic file operations, which include:
Naming a file
Opening a file
Reading data from a file
Writing data to a file
Closing a file
Post a Comment