0
6.5kviews
What is a file? Explain the following file handling functions in c fopen(), fread(), fwrite().

Mumbai University> FE > Sem 2> STRUCTURED PROGRAMMING APPROACH

Marks: 4 M

Year: Dec 2016

1 Answer
2
324views

Files: A file represents a sequence of bytes on the disk where a group of related data is stored. File is created for permanent storage of data. It is a readymade structure.

There are five major operations that can be performed on a file are:

  1. Creation of file

  2. Opening an existing file

  3. Reading data from a file

  4. Writing data in a file

  5. Closing a file

fopen()

The fopen() function is used to create a new file or to open an existing file. General Syntax : *fp = FILE *fopen(const char *filename, const char *mode);

fread()

fread() function is used to read is a binary file. A Binary file is similar to the text file, but it contains only large numerical data. Function Reads Block of Data from Binary Mode File and Assign it to the Region of Memory Specified.[i.e Reads Block of Data From Binary File and Assign it to Some Memory ]

fwrite()

fwrite() function is used to write is a binary file. Function Writes Block of Data to Binary Mode File.[i.e Writes Block to Binary File]

Please log in to add an answer.