next up previous
Next: Magnetic disk storage Up: CS1011 lecture: Files and Previous: Operating systems

What is a file?

A file contains information, which may be in human-readable text form, or in other forms, e.g.

Files are most often held on magnetic disks, although other media can be used. In particular, optical disks are becoming common. Magnetic tape is used for files which aren't needed quickly, or for transporting them. Once upon a time, punched cards and paper tape were the state of the art! The point about all these media is that they are permanent - files persist until they are explicitly removed.

Although most of the files you will work with contain text, it is worth remembering that any file is just a sequence of bits (that is, 0s and 1s). In the case of a text file, the bits are interpreted as characters. In the case of an object program, the bits are interpreted as machine instructions. In the case of a file of some other sort of items - let's call them widgets - the bits are interpreted as widgets.

Files can also vary in other ways. For instance files may have additional structure attached to make it easier to access particular items. For example, a file of records in a database may have an index attached which, like the index of a book, enables a particular record to be found more quickly than by searching through the whole file from the beginning.


next up previous
Next: Magnetic disk storage Up: CS1011 lecture: Files and Previous: Operating systems
Pete Jinks
1998-10-30