One little endian question
Jeff Harrison
jeffaharrison at yahoo.com
Fri Feb 29 19:42:45 PST 2008
I have a routine that I developed to convert 2 binary
bytes of data from filepro's key header into a date
that filepro can understand. I know that sounds
strange, but this is needed, I think, since I'm using
an alien filepro file to map to a key file in order to
check for data integrity issues.
My routine is shown below - I will feed it the "1st"
byte of the date in the x field, and the "2nd" one in
the y field.
::dt1 = base(asc(x),"10","16"):
::dt2 = base(asc(y),"10","16"):
::longago = "01/01/1983":
::thedate = longago + base(dt1&dt2,"16","10"):
::'...:
::declare dt1(2):
::declare dt2(2):
::declare longago(10,mdyy/):
::declare thedate(10,mdyy/):
As you may know, there is an endian issue with certain
flavours of filepro running on certain boxes, where
the binary order is reversed - I'm assuming all I will
need to do in those cases is reverse dt1 and dt2 bytes
in my "thedate" assignment.
The question is, though, how will I know when I need
to do the reversal? Are there certain known values
for @os where it is one way or the other? Or is there
a better way to do this?
Jeff Harrison
jeffaharrison at yahoo.com
Author of JHExport and JHImport. The fastest and
easiest ways to generate filepro exports and imports.
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
More information about the Filepro-list
mailing list