comp.lang.ada
 help / color / mirror / Atom feed
* Read Binary File
@ 2003-11-03 15:56 Frank Mattison
  2003-11-03 16:00 ` Lutz Donnerhacke
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Frank Mattison @ 2003-11-03 15:56 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-11-05 10:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-03 15:56 Read Binary File Frank Mattison
2003-11-03 16:00 ` Lutz Donnerhacke
2003-11-03 16:37 ` Read Binary File (on Compaq Ada) Larry Kilgallen
2003-11-03 22:34 ` Read Binary File Gautier Write-only
2003-11-04  3:24 ` Steve
2003-11-05 10:11 ` Thierry Lelegard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox