We can store data in a file and retrieve data from that file by program in C programming. When you input data from keyboard by scanf() function it will be no longer available after cancelling the output screen.So it is nice way to save data by file management.
To save data into a file you have to follow the following steps:
step1: Open a existing file or create new file
step2: Write data into that file.
To retrieve data from a file you have to follow the following steps:
step1: Open existing file.
step2: Read data from that file.
It is good practice to close file when it is no longer needed. Next we will learn how to open a file.