Subj : Re: I need a routine to convert a real48 type into a double To : borland.public.cpp.borlandcpp From : Ed Mulroy Date : Tue Aug 02 2005 08:44 am See if this does the trick: http://orion.planet.de/~jan/Snippets.9707/_d0903.html Your program is a 32 bit one and elements in a structure are aligned on 32 bit or 4-byte boundaries. You are reading in a packed structure, a structure aligned on 8 bit or 1-byte boundaries. To do that you must specify a packing size of 1 byte. #pragma pack(1) /* set 1-byte alignment */ struct TMyCBuilderStruct { unsigned char aReal48Value[6]; unsigned char aByteValue; unsiged short aWordValue; and so on... }; #pragma pack() /* restore the original alignment */ Note that your question is about C++ Builder. However you have posted it here, in the newsgroup for the old Borland C++ compiler. Please post questions in newsgroups where what you are asking about is the expected subject. You can identify which newsgroups are for C++ Builder by the word 'cppbuilder' in their name. .. Ed > E. Kali wrote in message > news:42ef32d4$1@newsgroups.borland.com... > > I've got the following problem. I'm reading data out of a binary file > which had been written by a Delphi application. > The data structure of the delphi application which wrote the data looks > like this--> > > TMyDelphiRecord = packed record > aReal48Value : Real48; > aByteValue : Byte; > aWordValue : Word; > and so on... > end; > > My C++ Builder application reads the into a data structure like this > > struct TMyCBuilderStruct{ > unsigned char aReal48Value[6]; > unsigned char aByteValue; > unsiged short aWordValue; > and so on... > }; > > My question ==> how can I convert the aReal48Value into a valid c++ double > value?. .