From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2aaba1527862ef22,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!m58g2000cwm.googlegroups.com!not-for-mail From: "frikk" Newsgroups: comp.lang.ada Subject: Reading Float Data from a binary file into ada Date: 30 Jan 2007 07:51:47 -0800 Organization: http://groups.google.com Message-ID: <1170172307.292500.256090@m58g2000cwm.googlegroups.com> NNTP-Posting-Host: 12.129.98.129 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1170172313 24742 127.0.0.1 (30 Jan 2007 15:51:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 30 Jan 2007 15:51:53 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 TRY0PX01 Complaints-To: groups-abuse@google.com Injection-Info: m58g2000cwm.googlegroups.com; posting-host=12.129.98.129; posting-account=192wHg0AAAAzciSzoZsEBI9bw5pVCopO Xref: g2news2.google.com comp.lang.ada:8708 Date: 2007-01-30T07:51:47-08:00 List-Id: 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