Le 16 janv. 07 à 01:48 Matin, Dennis Birch a écrit:
On 1/15/07, Louis G5 Batayte <[EMAIL PROTECTED]> wrote:
MacOS X 10.4.8 RB 2007R1
I let the user select a folder, then I search through the items in
that folder looking for jpeg files. Right now I am looking at the
extension to determine if it is a jpeg or not. But I am trying to
determine if a file without an extension is a jpeg file. If I take a
jpeg file with an extension, and use the MacOS System "Get Info" to
delete the extension, the System "Get Info" still displays the "Kind"
as a jpeg file. But I cannot figure how to determine this from
within RealBasic. When I look at the contents of the folderitem, for
the file without the jpeg extension, in debug mode, there is
nothing there to indicate the file type/kind. Any suggestions?
From looking at a handful of JPEG files in a hex editor, it
appears that the
first 10 bytes of every JPEG file is identical: ff d8 ff e0 00 10
4a 46 49
46. So you might consider opening each file, or each questionable file
perhaps, and reading the first 10 bytes of its binarystream to see
if it
matches that pattern.
What about if I create an application which writes files with the
same pattern?
I mean: is reading bytes of a file a reliable way to determine it's
contents?_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>