< Prev

C - Modifying a file on Disk

In our last article, we have explained how to append new data to a file on the disk. In this tutorial, we are going to explain how to modify data of an existing file on disk. For this, the C language provides us a structure called FILE, which is defined in the header file <conio.h>. The FILE structure allows us to create, read, write/modify the file on disk.

The FILE structure provides us a function named fopen(), using which we could provide location of the file stored on the disk and in return(if the file is found), the fopen() function open the file and gives us a pointer which is pointed at either the first character position or the last character position in the file, depending on the mode in which we open this file. Let's read the file mode to use to modify the content of a file.

Please Subscribe

Please subscribe to our social media channels for daily updates.

Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page



Please check our latest addition