Linux flle structures

Pages: 12
to clarify, when I said there are no magic numbers, it depends on how you define that.
I am saying this: every byte in the file is accounted for in the file format specification. However the value is obtained (many ARE constants), it is specified what goes where and how the value is determined** (size of the file, date, constant value, whatever it is).


So yes, it may 'be' a 'magic number' in the sense that, for the ongoing bmp format discussion as an example, the first 2 bytes are always "BM" which is a 16 bit magic number in the sense of a c++ code magic number (a value plunked in the middle of code with no way to know what it means or where it came from). But there is no magic in the magic number, the spec says "put BM there".

**ok, it is actually fairly popular in file formats to have unused chunks of bytes for padding (struct alignment) or reserved for future use etc where the value can be anything at all, but by telling you it is padding/unused/etc it still tells you what can go there (anything).
Last edited on
Check this out:
https://en.wikipedia.org/wiki/List_of_file_signatures

This discussion is going a bit beyond my comprehension level, but I just wanted to add that to it.
Registered users can post here. Sign in or register to post.
Pages: 12