- We normally often need to store data through our programs on some permanent storage devices so that we are able to access the data some other time. Such a data is stored on the memory device in the form of a data file. Thus,data files allow us to store information permanently, and to access and alter that information whenever necessary. The C library provides set of library functions to perform read and write operations on files. A computer file is a collection of data stored on a non volatile device in a computer system. Files exists on permanent storage devices, such as hard disks, DVDs, USB drives, and reels of magnetic tape.
- There are two different types of data files, called stream oriented (or) standard data files and the system oriented (or) low level data files.
- Stream oriented data files are generally easier to work with and are therefore more commonly used. These files are sub divided into two categories: The first category is of text files, that which consists of consecutive characters. These characters can be interpreted as strings or numbers or-else individual data items. The manner in which these characters are interpreted will use library functions such as scanf and printf statements etc. The second is often referred to as unformulated data files. They organizes data into blocks containing contiguous bytes of information. These blocks represent more complex data structures, such as arrays and structures. A separate set of library functions are available for processing stream oriented data files of this type.
- System oriented data files are more closely related to the computer's operating system than stream oriented. They are somewhat more complicated to work with, though their use may be more efficient for certain kind of applications.
- Data files are most frequently used to store user's data. However data related to numbers can be efficiently stored in the form of binary files, which are also useful to handle file containing machine language contents. The files which are stored in binary format differ significantly from data(i.e.text files).
- Text Files;which contain data that can be read in a text editor because the data has been encoded using a scheme such as ASCII or uni-code. Text files might include facts and figures used by business programs, such as a payroll file that contains employee numbers, names, and salaries.
- Binary file;which contain data that has not been encoded as text. It mean that the binary file always contains binary digits. Examples include images and music.
- A byte is a small unit of storage; for example, in a simple text file, a byte holds only one character. Because a byte is so small. File sizes usually expressed in kilo bytes(thousands of bytes), mega bytes(millions of bytes), giga bytes(billions of bytes).
The C language treats all the information that enters a program or leaves a program as a stream of bytes or series of bytes. We can work on files by using input or output streams.
For a quick summery, visit the below given link.
http://ctechrockz.blogspot.in/2013/04/an-overview-of-files.html
From site : http://ctechrockz.blogspot.com/
No comments:
Post a Comment