Reading bytes in a file.

Discussion created by pedantic on Aug 27, 2012
Latest reply on Aug 28, 2012 by TomHays

Hello everyone.


In my Filemaker I have to enter information on data files, including which version the data file is to be used with, for example "CS2", "CS3" and so forth. It just so happens that if I examine bytes 29 and 33 of the file I can get the information I need to determine version. I am using the following code in order to trap that information:


TrFile_GetContents( "" ; Files::Path & Files::Name ; 0; 20)


and then the following code to determine whether I got the right information:


Show Custom Dialog["Digit values"; "The first digit is " & $FirstDigit & " and the second digit is " & $SecondDigit & "."]


TrFile_GetContents() should be returning 0 or 0x07 (or some similar value between 4 and 9) or 0x05 (the only value ither than 0). No matter what I do, however, I cannot seem to get the single digits to print. Without fail I get a space where the data should be. I've tried using some of the native functions that come with Filemaker to make FM recognize the values, but nothing seems to work. Does anyone have an idea I might try?


The ultimate plan is to use the digit values either in a switch statement or a nested if/else statement to assign text to a field, like this:


if($FirstDigit = 4)

Field:version = "CS3"

else if($FirstDigit = 5)

Field:version = "CS4"


and so on.


Does anyone have an idea I might try?