Monday, 9 March 2015

Handling Files in C


The programs that we developed up to now were neither able to produce permanent output nor were they able to read data inputs other than from the keyboard. Using files you can save your output data permanently and retrieve them later.

A file in general is a collection of related records, such as student information, marks obtained in an exam, employee salaries, etc. Each record is a collection of related items called fields, such as “student name”, “date of birth”, “subjects registered”, etc. The common operations associated with a file are:

· Read from a file (input)
· Write to a file (output)
· Append to a file (write to the end of a file)
· Update a file (modifying any location within the file)

In C language data is transferred to and from a file in three ways:

· Record input/output (one record at a time)
· String input/output (one string at a time)
· Character input/output (one character at a time)


No comments:

Post a Comment