what is file handling in c

11 months ago 39
Nature

File handling in C refers to the process of creating, opening, reading, writing, and closing operations on a file using C language functions

. C language provides different functions such as fopen(), fwrite(), fread(), fseek(), fprintf(), etc. to perform input, output, and many different C file operations in our program

. The use of file handling is important because it allows us to store the information fetched from the program, providing high reusability

. There are two types of files in C: text files and binary files

. Text files contain data in the form of ASCII characters and are generally used to store a stream of characters, while binary files store information in the form of 0’s or 1’s, taking less space

. The FILE macro is used to declare the file pointer variable, which is used in almost all the file operations in C

. The functions used for file handling in C include fopen(), fclose(), fprintf(), fscanf(), fseek(), fread(), fwrite(), etc.