comp.lang.ada
 help / color / mirror / Atom feed
From: johnherro@aol.com
Subject: Re: A Text_IO Question
Date: 1996/11/11
Date: 1996-11-11T00:00:00+00:00	[thread overview]
Message-ID: <19961111132700.IAA28229@ladder01.news.aol.com> (raw)
In-Reply-To: 562d9o$hqq@news-e2c.gnn.com


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.

The other thing to consider is using memory, if you have enough memory. 
For example, you might keep the header in memory, and the rest of the data
in a temporary file.  When you're all ready, write out the (real) header
from memory to your final Text_IO file, and then copy data from the
temporary file to the final Text_IO file.  Finally, delete the temporary
file.  I hope this helps.

- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




  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 [this message]
1996-11-11  0:00   ` Robert Dewar
replies disabled

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