Re: Appending to files in OberonF/Component Pascal 1.2

Clemens Szyperski (szypersk@fit.qut.edu.au)
Fri, 22 Aug 1997 14:51:37 +1000 (EST)

Les,

Have a look at function Files.dir.Old - which opens an existing ("old") file
either in exclusive r/w or in shared r/o mode. You want to open it in
exclusive mode, get a new writer from that file, set it to the end of the
file, and append ASCII simply by writing to the file. You do not need to
close the file again - the garbage collector would do this for you
eventually, but with a file open in exclusive r/w mode it is a good idea to
close it eagerly as soon as you are done with it.

As an aside: Stores use their own special file format and thus cannot be used
to process ASCII files. Converters does not provide any means by itself to
process ASCII files, but allows you to tell the system how to open one of
your ASCII files into a regular user-viewable/editable document (if that
makes sense), and how to map such a document back to one of your ASCII files
(again, if that makes sense).

Another aside: notice that Oberon/F can open any ASCII file with readable
text in it as a document and that upon saving a document (use Save As... if
it's not a new document) you can select the output format - and ASCII is one
of the options.

Hope that helped,

- Clemens

On Fri, 15 Aug 1997, Les Snively wrote:

> I've been trying to find a way to append ascii data to an ascii file
> in a project I'm exploring in OberonF 1.2. "Stores" and "Converters"
> have eluded my attempts to understand and experiment with in any
> meaningful way (the present documentation and my way of grasping ideas
> seems not to work together successfully). This has forced me to use
> ObxAscii as the basis for the ascii file manipulations that I've done to
> date. However, it seems ObxAscii, through several intermediate steps,
> will only open a file in a write-from-scratch mode, rather than an
> "append" to existing mode.
> I only need to append data at the end of an existing file, it's a
> log file, essentially. Is there a relatively simple way to do this in
> OberonF that I haven't discovered? Or do I have to start from scratch
> and build up my own byte by byte file writing mechanism? Any suggestions
> would be appreciated.
>
> Les Snively
> les@windstream.com