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.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,305f22b27bd2e6cb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-03 19:24:28 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!attbi_s51.POSTED!not-for-mail From: "Steve" Newsgroups: comp.lang.ada References: <6449213e.0311030756.64346802@posting.google.com> Subject: Re: Read Binary File X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: NNTP-Posting-Host: 12.211.58.135 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s51 1067916267 12.211.58.135 (Tue, 04 Nov 2003 03:24:27 GMT) NNTP-Posting-Date: Tue, 04 Nov 2003 03:24:27 GMT Organization: Comcast Online Date: Tue, 04 Nov 2003 03:24:27 GMT Xref: archiver1.google.com comp.lang.ada:2021 Date: 2003-11-04T03:24:27+00:00 List-Id: Do the Ada-generated files also have the Record format: Stream_LF? I faced a similar problem on VAX VMS a number of years ago. I can't remember exactly how I solved it, but I believe I had to make special system calls to handle Stream_LF files. C and C++ like to view files as streams of bytes. VMS has more of a record oriented file system. Mapping between the two takes a little extra work. >From the Ada LRM: "The exception Use_Error is propagated if an operation is attempted that is not possible for reasons that depend on the characteristics of the external file." I've never used VAX Ada (I used VAX Pascal). Perhaps there is some "Form" selection you can make to indicate the files are "Stream_LF" files. Steve (The Duck) "Frank Mattison" wrote in message news:6449213e.0311030756.64346802@posting.google.com... > 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