-->

File Management in C

File Management in C
FILE:
·        We are using scanf and printf functions to read and write data.
·       These are called formatted input/output functions, which always use the console (keyboard and monitor).
·               This works fine as long as the data is small.
·         Many real-life problems involve large volumes of data and in such a situation, the console I/O has two problems.
1.             It becomes cumbersome and time consuming process to handle large volumes of data through the terminal.
2.             The entire data is lost when the program is terminated or the computer turned-off.
·             It is necessary to have a more flexible approach where data can be stored on disks, and read whenever necessary, without destroying the data. In such situations we use the concept of files.
·               A file is a place on the disk where a group of related data is stored.
·               Basic file operations such as:
o      creating a file
o      opening a file
o      reading data from a file
o      writing data to a file, and
o      closing a file
·               There are two distinct ways to perform file operations in C.
o      The first one is known as the low-level I/O and uses Unix system calls
o      The second method is referred to as the high level I/O operation and uses functions in C language's standard I/O library

Related Posts

Subscribe Our Newsletter