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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,305f22b27bd2e6cb,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-03 07:56:33 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: fmattison@ssd5.nrl.navy.mil (Frank Mattison) Newsgroups: comp.lang.ada Subject: Read Binary File Date: 3 Nov 2003 07:56:33 -0800 Organization: http://groups.google.com Message-ID: <6449213e.0311030756.64346802@posting.google.com> NNTP-Posting-Host: 132.250.166.238 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1067874993 21182 127.0.0.1 (3 Nov 2003 15:56:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 3 Nov 2003 15:56:33 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:1993 Date: 2003-11-03T07:56:33-08:00 List-Id: Does anyone have a suggestion for reading this binary file? Situation: OpenVMS, Alpha, Ada '83. Binary file created by C++ program. Use_Error raised on first byte. We regularly read Ada-generated binary files, but the C++ source in new. with Sequential_IO; with Text_IO; procedure Test_Sio is type Byte is range 0..255; for Byte'Size use 8; package Byte_IO is new Sequential_IO(Byte); Test_Byte : Byte; File : Byte_IO.File_Type; begin Byte_Io.Open (File => File, Mode => Byte_Io.In_File, Name => "TEST.BIN"); Trap: begin Byte_IO.Read(File => File, Item => Test_Byte); exception when Byte_IO.Use_Error => Text_IO.Put_Line("Use Error raised on Byte_IO.Read"); Byte_Io.Close (File => File); end Trap; exception when others => Text_IO.Put_Line("Other exception raised"); Byte_Io.Close (File => File); end Test_Sio; Result: >run test_sio Use Error raised on Byte_IO.Read >dump/byte/page test.bin 00 00 07 D3 34 35 35 37 00 00 05 C8 00 D2 00 01 ..�.�...7554�... 000000 3E 08 BD B3 53 AE C1 56 00 00 CA D8 00 00 00 F7 �...��..V��S��.> 000010 A4 13 65 CF FD C1 41 7A 12 7E C8 E7 A4 6D C1 36 6�m���~.zA���e.� 000020 Have tried essentially all variations on the file attributes and formats beginning with these, which work for files created by Ada: Record format: Variable length, maximum 0 bytes, longest 1480 bytes Record attributes: Carriage return carriage control RMS attributes: None Record format: Stream_LF, maximum 0 bytes, longest 32767 bytes Record attributes: Carriage return carriage control RMS attributes: None Thanks for any suggestion! Frank Mattison