Reading Float Data from a binary file into ada



Hello everyone! I am having a problem that I would love some help
with.

Essentially I was given a Visual Basic program that dumps a binary
configuration file with all of the variables in a set. The variables
are each 32 bit floats, with the first 16 bits being the integer part
and the second 16 bits being a representation of the fraction (I'm not
sure if this is stanard - but its just how VB dumps the data). The
binary dump is basically a copy of the way VB stores the data in
memory. I need to be able to use this data in ada. There is a C
counterpart to this that makes use of a 'union' to grab the data 1
byte (8 bits) at a time, put them into a char array of size 4, then
use a 32 bit float to reference the data. Is there somehow I can do
this in ada as well?

Basically I need to be able to read in the binary data byte by byte
but store it into a 32 bit Float. The C union example above uses the
same memory address for the Float as it does for the size 4 char
array. I don't even know if the VB dump will correspond with the way
ada handles floats or not, but I'll worry about that later.

I am also using Matlab/Simulink if that provides any additional tools
to use for debugging.

Thank you for any help,
Blaine

.



Relevant Pages

  • Re: Reading Float Data from a binary file into ada
    ... Essentially I was given a Visual Basic program that dumps a binary ... configuration file with all of the variables in a set. ... byte at a time, put them into a char array of size 4, then ... If the C program is using a union to view the data as either a float or a 4 ...
    (comp.lang.ada)
  • Re: Reading Float Data from a binary file into ada
    ... Essentially I was given a Visual Basic program that dumps a binary configuration file with all of the variables in a set. ... The variables are each 32 bit floats, with the first 16 bits being the integer part and the second 16 bits being a representation of the fraction (I'm not sure if this is stanard - but its just how VB dumps the data). ... There is a C counterpart to this that makes use of a 'union' to grab the data 1 byte at a time, put them into a char array of size 4, then use a 32 bit float to reference the data. ... Is there somehow I can do this in ada as well? ...
    (comp.lang.ada)
  • Re: Reading Float Data from a binary file into ada
    ... Essentially I was given a Visual Basic program that dumps a binary configuration file with all of the variables in a set. ... The variables are each 32 bit floats, with the first 16 bits being the integer part and the second 16 bits being a representation of the fraction (I'm not sure if this is stanard - but its just how VB dumps the data). ... There is a C counterpart to this that makes use of a 'union' to grab the data 1 byte at a time, put them into a char array of size 4, then use a 32 bit float to reference the data. ... Is there somehow I can do this in ada as well? ...
    (comp.lang.ada)
  • Re: Reading Float Data from a binary file into ada
    ... The variables are each 32 bit floats, with the first 16 bits being the integer part and the second 16 bits being a representation of the fraction (I'm not sure if this is stanard - but its just how VB dumps the data). ... There is a C counterpart to this that makes use of a 'union' to grab the data 1 byte at a time, put them into a char array of size 4, then use a 32 bit float to reference the data. ... Is there somehow I can do this in ada as well? ... package Unsigned_32_IO is ...
    (comp.lang.ada)
  • Re: Reading Float Data from a binary file into ada
    ... Essentially I was given a Visual Basic program that dumps a binary ... are each 32 bit floats, with the first 16 bits being the integer part ... This looks like a fixed point representation, ... I need to be able to use this data in ada. ...
    (comp.lang.ada)