From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: A Text_IO Question
Date: 1996/11/11
Date: 1996-11-11T00:00:00+00:00 [thread overview]
Message-ID: <dewar.847731993@merv> (raw)
In-Reply-To: 19961111132700.IAA28229@ladder01.news.aol.com
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.
prev parent reply other threads:[~1996-11-11 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-09 0:00 A Text_IO Question Andy Askey
1996-11-11 0:00 ` johnherro
1996-11-11 0:00 ` Robert Dewar [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox