most programs use the extension to get the file type (stupid programs. ... should be shot)
anyways .. its faster to get the file type by the extension .. but in case of certain programs, its best to use the hearer of the file to determine what to do with it (like a file manager, should display files based on there extension for speed, and execute the program based on header value, as to not evidently run a mpg as a web page,.............)
anyways, in the first part of most file types (except plain text) they usually have a special number, or word thats common to all files of that type (look at the file manager worker .. it determines file types this way .. you can set up a file type by telling it to look at 3 files, it compares the heads of all these files and takes what is common in all and uses that to determine of a file is of that type)
anyways, with shared mime info from freedesktop.org , it stores both extension, and i believe what is called magic numbers (the header common to all files of this type you could say) ....
|