Skip to main content

Posts

Showing posts with the label File handling in C

File Handling and Various File Opening Modes in C

Every programs we were doing before were using Memory for storage and all those memory would wipe out once the program is terminated.But sometime the case is different,what if we need all those data again,We need to re-enter all those bulky data again,which will again be wiped out once the program is terminated. So we need to store the data in such a place such that it can be retrieved and displayed again and again.This is why we need files.The place about which we previously talked is the file on the disk.So we need File Handling to work with files. Let us see how a file can be handled. Various Operations in Files Creating a File Opening a File Reading from a File Writing to a File Closing a File File Opening Modes in C Before performing any operations in files,we must create/open the file . Here are the various File opening modes in C. "r" : It searches the file.If the file opens up successfully,the function fopen() loads the file from disk to memory and sets a pointer