Fiddling With Files!


© Chris Cruickshank

This week's article looks at files, what are they, why we need them and why the computer seems to know which files belong to which program.

What are Files?

All information that your computer handles is stored in files. Files are individual units of data that occupy space on your hard disk. A file can be a document, a picture, a program — anything that is stored and processed by your computer.

When you "open" a file you are telling the computer to go and retrieve and then load into memory that unit of data. When you "save" a file, the computer takes the unit of data in memory and writes it to the hard disk (or a floppy disk of course!).

As far as a computer is concerned, a file is simply an area of hard disk that is referenced by a single name — the name of the file. In order to make this more efficient, the computer divides files into folders (or, more correctly, directories). Within each directory, you can store files. It is possible to store a file called "myfile.txt" in every directory, but a file name must be unique within a directory. You cannot have two "myfile.txt" files in the same directory as the computer would not know which one you were referring to.

All files are stored in binary — that is, 1's and 0's. The program you are using will determine how those 1's and 0's are treated. A paint package will assume that the file is a picture, while a word processor will think it is a document. Some files are not meant to be "displayed'" and if you try to do this, you will "see garbage." This is because the file contains 1's and 0's that could well be computer instructions. This is a program (like a word processor, paint package).

So how does the computer "know" what is and is not a valid file to "open"?

File Types

This is handled in two ways. First, there are "File Types." A file type is an (up to), 3-character extension that appears after the dot of a file name. In the example above — myfile.txt, the name of the file is "myfile" and the extension is "txt." So that the computer knows where the name ends and the extension begins, they are separated by a dot — hence myfile.txt. Different programs will use different extensions in order to determine the type of file. This, on its own, is not good enough as there is nothing to stop you naming, say, a text file with a picture file extension. Like renaming myfile.txt to myfile.bmp. If your paint program tried to open myfile.bmp the text simply isn't a picture and rather than attempting to open the file as a picture, you will get an error message. How does the computer know this? This is achieved by using header records.

Go To Page: 1 2 3


The copyright of the article Fiddling With Files! in PC Support is owned by . Permission to republish Fiddling With Files! in print or online must be granted by the author in writing.

Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo


Here's the follow-up discussion on this article: View all related messages

2.   Feb 3, 1998 3:53 PM
Chris Cruickshank

Karin,

Yes - you have to be careful when using file associations, althouhg there are instructions withing windows on how to do this.

In Windows 95 it is more difficult than ...


-- posted by C_Cruickshank


1.   Jan 17, 1998 10:41 AM
We are having trouble with FILE ASSOCIATION. You have to associate with something,before it can be called up. I have gotten in more trouble with this and had to call a comp. wizzard in, to fix my comp ...

-- posted by Karin





For a complete listing of article comments, questions, and other discussions related to Chris Cruickshank's PC Support topic, please visit the Discussions page.