C Operations on Files

 

Operations on Files

There are basically four operations we can perform on files in C:

 

  • Creating a File:

We can create a file using C language, in any directory, without even leaving our compiler. We can select the name or type we want our file to have, along with its location.

 

  • Opening a File:

We can open an existing file and create a new file and open it using our program. We can perform different operations on a file after it has been opened.

 

  • Closing a File:

When we are done with the file, meaning that we have performed whatever we want to perform on our file, we can close the file using the close function.

 

  • Read/Write to a file:

After opening a file, we can access its contents and read, write, or update them.