MadSci Network: Computer Science |
The empty file does take up some space, sort of, but it may or may not actually have any impact on the free space left on your disk. What follows applies to the Windows 9x operating system. Every file on disk has an entry in a special kind of file called a directory. This is the file programs read to tell you what files are actually on your disk. Before long file names were introduced, these directory entries took 32 bytes each; now they can vary in length. Poking around with the DEBUG utility, I verified that when you create your zero length file, you don't actually use up any room on the disk for the file contents, but you do use up some space in the directory file. If the directory file is full, it could conceivably expand, and that would take up some space on this disk. Some of the older books on DOS are especially good at pointing out exactly how the disk is put together. I used "Underground DOS 6.0," by Dan Gookin, ISBN 0-553-37097-9 as a guide. While this answer specifically applied to Windows 9x O/S, the same general scheme is used for every disk format I've ever looked at. All have some form of directory entry, and every file uses some space in the directory. In some cases, a zero length file actually uses some space on the disk, generally the smallest amount of space you can allocate. Mike Westerfield
Try the links in the MadSci Library for more information on Computer Science.