Tagged: opening a file in C

Opening a file in C 2

Opening a file in C

We can perform read and write operations on a file in C. But, before that we must open a file. To open a file in C, we have to call the function fopen() as shown below: FILE *fp; fp = fopen(“file1.C”,”r”); The above statement would open file named “file1.C” in “read” mode. It tells the computer that the file being opened would be used for reading purpose only. fopen() performs three important tasks when you open the file in “r” mode: Firstly, it searches the file to be opened on the disk Then it loads the file from the disk into...

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet