[ooc-compiler] Help With I/O
Brought to you by:
mva
|
From: Gregory G. <gre...@tt...> - 2004-05-26 16:09:04
|
Hello All,
I am completely new to Oberon, and am attempting to learn the language. I
understand the basics of the language as described in Wirth's book, but am
having some difficulty in learning the oo2c library. I have the following
program:
MODULE DisplayFile;
IMPORT Files, TextRider, Out, Msg;
VAR
reader : TextRider.Reader;
file : Files.File;
string : ARRAY 256 OF CHAR;
res : Msg.Msg;
BEGIN
(* open the file "HelloWorld.Mod" for reading *)
file := Files.Old("HelloWorld.Mod", {Files.read}, res);
(* connect the reader to the file *)
reader := TextRider.ConnectReader(file);
reader.ReadLine(string);
WHILE reader.res = Files.eof DO
Out.String(string);
Out.Ln;
reader.ReadLine(string)
END;
END DisplayFile.
I have several difficulties running this program. The program displays the
contents of the file "HelloWorld.Mod", with the exception of the last line.
How can I specify the termination condition of the loop to read "While not
end of file do"?
Also, can someone explain the meaning of the third parameter 'res' of the
Files.Old function call?
Furthermore, in Wirth's book, the I/O functions that are described differ
from those present in the oo2c library. Am I correct in understanding that
these are the ones defined in the Oakwood modules? If so, what are the
benefits/drawbacks of one over the other?
Thank you kindly,
Gregory Gelfond
|