Skip to main content Accessibility help
Internet Explorer 11 is being discontinued by Microsoft in August 2021. If you have difficulties viewing the site on Internet Explorer 11 we recommend using a different browser such as Microsoft Edge, Google Chrome, Apple Safari or Mozilla Firefox.

Chapter 16: File

Chapter 16: File

pp. 461-506

Authors

, Techno India Hooghly, West Bengal, , Techno India College of Technology, West Bengal
  • Add bookmark
  • Cite
  • Share

Extract

So far the programs are written following the console I/O operations. The inputs are taken through keyboard, these inputs and calculated data are stored in the memory, i.e., in the RAM and output is shown through VDU. But there are some problems related to this system when we need to handle large volume of data. As the data are stored in the main memory, the entire data set is lost as soon as the program is terminated. So for next execution of the program we need to enter the entire inputs. It is very tedious and time consuming to take input a large volume of data through keyboard every time the program executes. Thus it would be much better if we able to store these data permanently so that we can read back whenever required. The solution is file as file is the only place where the data can be stored permanently. C supports a large set of library functions for file handling. These are known as disk I/O or file I/O functions. In this chapter, we will discuss about files I/O functions which help us to know how to write data in files and how to read data from files. These are almost similar to console I/O functions except that these are operated on files.

WHAT IS A FILE?

A file can be defined as a repository of data or more preciously collection of bytes stored on a secondary storage device as it is permanent storage of data. Depending on the interpretation of these bytes several types of file may form. It may form textual document, a database file, an image file or file of any other form. The type of a particular file is decided entirely by the data structures and operations used by a program to process the file.

Depending on the way a file is opened for processing, a file can be classified as a text file or a binary file. The mode of opening a particular file differs in three main areas.

About the book

Access options

Review the options below to login to check your access.

Purchase options

Paperback
US$105.00

Have an access code?

To redeem an access code, please log in with your personal login.

If you believe you should have access to this content, please contact your institutional librarian or consult our FAQ page for further information about accessing our content.

Also available to purchase from these educational ebook suppliers