Question Problem reading double precision values from binary file.

MaxD

New member
Joined
Feb 19, 2010
Messages
2
Programming Experience
Beginner
Hi I am stumped.
I am attempting to read a series of double prcision float values (x,y,z coordinates) from a binary file using the binary reader. Everything works fine except that when I read the number back it is different then the number that was written there (original file is generated by mining application).
written number : 78897.6476586
file contents hex : 40 F3 43 1A 5C CF 43 A4 this converts back to the same number as written using a IEE 754 conversion program.
VB returned value : -5.45100266729248E-134 using .readDouble()
I have tried to step thru the file in one byte steps to make sure that I have the propper start position but that did not help any. Is there something that I am missing or doing wrong??
I am new to VB .net and this forum so sorry if this has been asked before, but a forum search did not turn up anything.

Thanx for any help MaxD
 
Thanks for the idea.
When I wrote the value to the file using BinaryWriter and looked at it in the hex editor I realized that the order of the bytes is reversed. File is Big Endian BinaryReader reads it as Little Endian, should have thought of this myself.

Thanks.
 
Back
Top