Reading a Windows 'binary' float into a ASP jscript variable

Posted by user89691 on Stack Overflow See other posts from Stack Overflow or by user89691
Published on 2010-06-02T04:19:57Z Indexed on 2010/06/02 4:23 UTC
Read the original article Hit count: 363

Filed under:
|
|
|
|

I need to read files produced by a legacy Windows app that stores real numbers (the 8-byte "double" type) in binary - i.e. as a packed array of 8 bytes. I can read the 8 byte group OK but how can I present it to my ASP JScript code such I can get the real number back again.

Or to put it another way:

Say a file was produced by a Windows (Delphi) program:

Assign (f, 'test.bin') ;
rewrite (f, 1) ;
r := 1234.56E78 ;
BlockWrite (f, r, SizeOf (Double)) ;
Close (f) ;

Inspection of the file will show it contains 8 bytes, being:

94 0E 4C CA C2 97 AD 53

which is the real number in IEEE format. Assuming I can read these 8 bytes back in ASP, is there a simple way of getting the real number back again?

© Stack Overflow or respective owner

Related posts about asp

Related posts about convert