Friday, 30 March 2012

Introduction - File


INTRODUCTION 

è    A console oriented I/O function like prinf() and scanf() is used to read and write data. To read and write data from these functions, it is always uses keyboard and output screen. When data is small at that time it is very useful , but when the amount of data is very large in that situation console oriented I/O operations has two main problem.

1.     To handle large amount of data through terminal becomes time consuming and tedious task. It is not enough to display data on the output screen . If the data is large , only a limited amount of data can be stored in memory and only a limited amount of data can be display on the screen.
2.     Computer’s  memory is volatile so entire data is lost when the program is terminated or computer is turned off and its contents would be lost once the program is terminated.

è    To overcome such problems need to store data on the permanent storage and read whenever necessary , without destroying the data.   The concept of FILE is used to store data permanently on disk. File is simply a sequence of binary digits.
è    There are two types of files.

1.     Text File
2.     Binary File

Text File

è    Text files store sequence of readable characters  such as alphabets , digits , punctuation or white space .
è     A text file can be thought of as a stream of characters that can be processed sequentially.
è    The extension of text files may be .txt file, .c file etc.

Binary File

è    A binary file is a computer file, which may contain any type of data, encoded in binary form for computer storage and processing purpose.
è    Binary files are usually a sequence of bytes , The extension of binary files may be .obj , .exe , .dat etc.

There are two types access methods:

1.    Sequential Files(Sequential Access)

An access method that requires traversal of all the records in sequential manner is known as sequential access. In this accessing method information from between can not be retrieved. Accessing of records start from beginning and traverse through all elements to reach that particular information.

2.    Random Access File(Random Access)
Random access allows to access any record or information from anywhere within a file. In this accessing method information that is in between the file can be  accessed directly.

Posted By : Ruchita Pandya

No comments:

Post a Comment