I assume there is some reason you want to look in the file itself instead of the file name? I usually just grab the last 3 characters of the file name when determining file types because that is much easier. Would that not work for you? It should unless your users are putting non-standard extensions on their file names.
Thanks for replying Taylorsharpe.
The answer is yes, there is a specific reason. All of these files are InDesign files and all of them regardless of version have file extensions of .indd, so the only way to determine whether these are CS3, CS4, CS5 files, etc., is to actually look inside the file for the exact version. The version values are found, as I said, at bytes 29 and 33.
Ahhh... that makes sense. Hmmm... I would have to play with reading the files hex values and see what I could come up with. I would probably first look at what functions are available in ScriptMaster.
I think the problem you are experiencing is due to the distinction between raw binary and FileMaker's text encoding. If you assign an arbitrary binary sequence directly to a FileMaker string, there is no FileMaker function that will let you access the raw bytes to get what you need. FileMaker's string handling functions assume that the data is a properly encoded (UTF16, I think) string.
Taylor's suggestion of using a plug-in that can interpret the binary data is the right approach.
I can show you how to solve this using the free LuaFy plug-in (www.luafy.com) which uses the Lua scripting language embedded in the plug-in (unlike ScriptMaster, no Java installation is required).
The Lua script is
local theFilePath = ...
local fp = io.open(theFilePath, 'rb')
local firstByte = fp:read(1)
local secondByte = fp:read(1)
return firstByte:byte(1) .. '\r' .. secondByte:byte(1)
$luaResult = LuaFy_RunScript("the Lua Script above"; Files::Path & Files::Name)
Using that Lua Script this function returns two numeric values separated by a line break.
$FirstDigit = GetValue($luaResult; 1)
$SecondDigit = GetValue($luaResult; 2)
(the author of the LuaFy plug-in)
Added example file