The simplest solution to your problem is to use ObxAscii, the example
module we provide which offers the interface you are looking for.
In the example below, procedure Write generates a new text, writes
an integer into the text and registers the text as file. (Module ObxAscii
can easily be adapted to write reals as well.)
Procedure Read opens this file, reads the integer and displays the result
in the log text.
MODULE Test;
IMPORT ObxAscii, DevLog;
PROCEDURE Write*;
VAR t: ObxAscii.Text;
BEGIN
t := ObxAscii.NewText();
ObxAscii.WriteInt(t, 123);
ObxAscii.Register(t, NIL, "Example")
END Write;
PROCEDURE Read*;
VAR t: ObxAscii.Text; i: LONGINT;
BEGIN
t := ObxAscii.Open(NIL, "Example");
ObxAscii.ReadInt(t, i);
DevLog.Int(i); DevLog.Ln
END Read;
END Test.
The file Example is an ascii file which can be read by any editor.
ObxAscii can easily be extended to support writing to already
existing files.
Hope, this helps,
- Dominik Gruntz
====================================================================
Dominik Gruntz Oberon microsystems, Inc.
gruntz@oberon.ch Technoparkstrasse 1
voice ++41-1-445-1751 CH-8005 Zurich
fax ++41-1-445-1752 http://www.oberon.ch/customers/omi
====================================================================