ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activetcl
activetcl
[Activetcl] Strange Problem with ::fileutil::fileType
by Michael Bahr other posts by this author
May 13 2008 8:52AM messages near this date
view in the new Beta List Site
Re: [Activetcl] Proposed Teacup behaviour change | Re: [Activetcl] Strange Problem with ::fileutil::fileType
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.

Why is it behaving this way?


Thank you, Mike...
_______________________________________________
ActiveTcl mailing list
ActiveTcl@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Michael Bahr
Andreas Kupries

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved