4 ms·
They are not. The article mentions before that sentence that the spaces are used for padding. In DOS, filenames are fixed 8+3 structures, and unused trailing po
by anyfoo 8y ago
They are not. The article mentions before that sentence that the spaces are used for padding. In DOS, filenames are fixed 8+3 structures, and unused trailing positions are padded out using spaces. You cannot, for example, have a space at the beginning of the extension, nor is the space at the end considered part of the extension at a higher level.
So it’s really just an internal representation detail. You might argue that padding with 0 would be better (if you go for fixed size at all), and nowadays that’s what you’d probably use, but it’s kind of arbitrary anyway, and since spaces were illegal in file names, they just used that. Today, 0 has the useful property of also acting as the terminator for zero terminated strings, which became popular through C. Back then, that mattered less.
Contrast this with modern file systems, where spaces in extensions are allowed (just like anywhere else in the file name, as the distinction usually does not exist on the fs level anymore).