One little endian question

Jeff Harrison jeffaharrison at yahoo.com
Sat Mar 1 09:27:10 PST 2008


--- Kenneth Brody <kenbrody at bestweb.net> wrote:

> Quoting Jeff Harrison (Fri, 29 Feb 2008 19:42:45
> -0800 (PST)):
> 
> > 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"):
> 
> I don't understand why you convert to hex,
> concatenate the values, and then
> convert ehm back to decimal, when you could simply
> multiply by 256 and add:
> 
>      longago = "01/01/1983"
>      thedate = longago + ( asc(x)*"256" + asc(y) )
[snip]

:-)  Great.  I knew I was putting Ken Brody bait out
there.

> 
> Why not just use GET16() instead, which defaults to
> using native byte
> order?
> 
> For example, let's assume that the 20 byte header is
> in the variable
> "Header" and you want @UD:
> 
>      longago = "01/01/1983"
>      thedate = longago + get16(Header,"6")
> 
> -- 

Perfect!  I'll try that.  Thanks!

Jeff Harrison
jeffaharrison at yahoo.com

Author of JHImport and JHExport. The fastest and
easiest ways to import and export with filepro. 


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 



More information about the Filepro-list mailing list