> I have a strange problem using ::fileutil::fileType. I have a file> exported from the Windows registry section [HKEY_LOCAL_MACHINE] and it> is about 121MB in size. When I run the ::fileutil::fileType on this> file it returns "binary audio mpeg". This is odd because this file is> plain text. However poking around the ::fileutil::fileType source code> I can **find** the characters that would trigger the file to be a binary> audio file. These characters are located deep within the exported file.> So I shortened the file to 121 KB (starting from the bottom-the top part> remained the same) and now ::fileutil::fileType returns "text".> Further poking into ::fileutil::fileType reveals that it defines a> buffer size of 1024 and then reads 1024 bytes into the buffer and> immediately closes the file. So I assume that it reads the first 1024> bytes to determine the file type.
Yes.
> Why is it behaving this way?
I am guessing that the code assumes that the magic markers which determine
the type of a file are found within the first KB of a file. Beyond that you
would have to ask the author of this procedure (Phil Ehrens, noted at the
top of the file. I have no idea if the email is still valid).
While I have extended this command in the past the basic design was done at
the time and the decisions regarding it _not_ recorded anywhere as far as I
know.
The 'These characters are located deep within the exported file.' however
seem to indicate that the code is reading not the first KB, but deeper in
the file ?
--
Andreas Kupries <andreask@[...].com>
Developer @ http://www.ActiveState.com
Tel: +1 778-786-1122
_______________________________________________
ActiveTcl mailing list
ActiveTcl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs