Page 1 of 1

Where's my bitmap filename?

Posted: Thu Jul 02, 2009 7:43 pm
by abarkley
Sorry to keep going on about .bmp files.

I want to read/analyse the header of a .bmp file on disk and do some stuff based on the analysis result.

I found this link helpful:

http://www.fortunecity.com/skyscraper/w ... ffrmt.html


But where's the filename? It must be embedded in the file somewhere otherwise how could you copy a single file (say, on a USB stick) to another machine? Isn't it?

Posted: Thu Jul 02, 2009 7:53 pm
by Trond
:roll:

Posted: Thu Jul 02, 2009 8:15 pm
by abarkley
That doesn't really get me any further.

Are you saying that that the characters of a filename are NOT contained within a file? It's not an unreasonable suggestion - other operating systems do it. I seem to remember name data in MS-DOS files.

If it's not, where is it? Going back to my USB stick example, obviously that's got a file structure...a FAT or whatever it's become since I last tried programming. Is that the only place the characters of the filename occur?

Posted: Thu Jul 02, 2009 8:21 pm
by Kaeru Gaman
your link is not usable, fifo reports an attack.

better use wiki: http://en.wikipedia.org/wiki/BMP_file_format

as you can see, the name isn't stored within the file itself.

... anyways, I never heard of such a practice.
the filename is just part of an entry in the FAT, even NTFS handles it that way, I think.

Posted: Fri Jul 03, 2009 9:56 am
by Trond
abarkley wrote:Are you saying that that the characters of a filename are NOT contained within a file?
Correct. They are not.
It's not an unreasonable suggestion
It's an extremely unreasonable idea, since it would mean all operating systems must know absolutely all file formats just to store the files.
- other operating systems do it.
No they don't. Windows doesn't do it. DOS doesn't do it. Linux doesn't do it. FreeBSD/OpenBSD/NetBSD/DragonflyBSD doesn't do it. Atari TOS didn't do it. MacOS <=9 didn't do it. OS X doesn't do it. It is just impractical to do it, so no one does it.
I seem to remember name data in MS-DOS files.
It is impossible that this name was a filename. The file can't know when it's moved. After moving the file the file would still contain the old filename. Word's files can also have a title attribute, but it's not the filename.
If it's not, where is it? Going back to my USB stick example, obviously that's got a file structure...a FAT or whatever it's become since I last tried programming. Is that the only place the characters of the filename occur?
The only place file names occur is in the filesystem.

Sorry to be rude, but this is something I think you should know before learning programming.