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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3939af2e1e61c8ee X-Google-Attributes: gid103376,public From: "John J. Cupak Jr." Subject: Re: Stream_IO Date: 1998/03/04 Message-ID: <34FD9042.41C67EA6@swl.msd.ray.com>#1/1 X-Deja-AN: 330814477 Content-Transfer-Encoding: 7bit References: <34fcb5c5.33132164@SantaClara01.news.InterNex.Net> To: Tom Moran Content-Type: text/plain; charset=us-ascii Organization: Raytheon Company Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-03-04T00:00:00+00:00 List-Id: Tom Moran wrote: > > Is there a way to use Stream_IO to read a file produced by other than > the program doing the reading, in particular, a file binary file > produced, say, with C? The RM indicates the representation is > implementation defined, and 'read apparently quite ignores rep > clauses, so I find one compiler reads integer things of 'size 8 or 16 > as 16, and another reads size 16 things as size 32. I hate to read > into a String and then do Unchecked_Conversions or 'address overlays, > but I don't see any other portable approach. Help! Tom, I solved a similar problem a while ago by creating a "Byte_IO" package, with generic Read and Write procedures for the user's data (typically, a record). The package instantiated Sequential_IO for bytes, and did unchecked conversion of the user's data (in the generic Read and Write code bodies) to byte arrays of corresponding size which were then read and written (depending on the appropriate procedure, of course). The application program had to "know" what kind of data it was supposed to read or write, as the generic Read and Write procedures certianly did not. This was easy, actually, since the first read/write was always a "header" record containing the counts of the various data records. Hope this helps. -- -------------------------------------------------------------- - John J. Cupak Jr, CCP - - Raytheon Systems Company - Software Engineering Laboratory - - tel: 508-858-1222 email (work): jcj@swl.msd.ray.com - - fax: 508-858-4336 email (home): jcupak@aol.com - --------------------------------------------------------------