Dave McGuire <mcguire at neurotica.com> wrote:*>> snip <<*
Nope, there is no such header in any UNIX implementation that I'm
aware of. The "magic number" you speak of isn't part of any
header...the "file" program opens the target file, looks at the first
few bytes, and then looks up the pattern in its database to arrive at
an *educated guess* as to the type of file it's looking at...for
example, if bytes 7-10 of the file are 0x4a464946 (ascii "JFIF"), it
is most likely (but not definitely!) a JPEG image file. Similarly,
if bytes 1-6 are 0x474946383961 (ascii "GIF89a") the file is most
likely a v89a GIF image file, and if bytes 1-8 are 0xfeedface, it's a
Mach-O executable from a MacOS X system.
It is important to understand, though, that this has nothing at
all to do with the operating system, and there is no common header
format of any sort. It just so happens that many types of files are
consistent in what their first few bytes contain.
Is the 0xfeedface ascii or hex?! ;) Was that deliberate or purely accidental, and who was
behind it?
I agree with what you are saying. When i was writing a program that involved using images
on my Amiga I discovered that the .IFF files always had the same ASCII within the first 20
bytes (well bytes 1-8 and 16-20, or thereabouts). I never realised that the same was true
about most file types.
Regards,
Andrew B
aliensrcooluk at yahoo.co.uk