< 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 contents of a file.




Please subscribe our social media channels for notifications, we post a new article everyday.

Decodejava Google+ Page Decodejava Facebook Page  DecodeJava Twitter Page

Coming Next
-
C++ and Python

Ad2