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,3f045ad8f12bb7f9 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: A Text_IO Question Date: 1996/11/11 Message-ID: #1/1 X-Deja-AN: 195821970 references: <562d9o$hqq@news-e2c.gnn.com> <19961111132700.IAA28229@ladder01.news.aol.com> organization: New York University newsgroups: comp.lang.ada Date: 1996-11-11T00:00:00+00:00 List-Id: iJohn Herro says, answering a question ajaskey@gnn.com (Andy Askey) writes: > The C program writes a ... dummy header to the > top of the file, process a lot of data, ... moves the > file pointer back to the top of the file, and overwrites > the dummy header ... I am just wondering if this is > possible with Text_IO. Unfortunately, no. To achieve random access, you need to instantiate Direct_IO. There are two ways to consider solving your problem. The first is to instantiate Direct_IO for type Character. The effect will depend on the system you're running. Instantiating Direct_IO for type Character works great on a PC, and I've done it several times. On a VAX running VMS, however, you can create a random access file for type Character, but you can't later read it as a plain text file. The file "attributes" are different, and the system remembers that you have a random access file and not a plain text file. DOS doesn't care. That's poor advice for Ada 95 at least. Using Stream_IO would be far more appropriate, and will solve the given problem precisely, whereas Direct_IO is quite inappropriate (it is likely to be slow, and the use described by John is highly non-portable, there is no guarantee that when you instnatiate direct_IO on charaer that the records will be single charaters.