problems with files

From: Juan Antonio Ortega <"Juan>
Date: Fri, 14 Dec 2001 20:32:37 +0100

In this module, I write in a file 11 numbers but, in "procedure read", I
read 12 numbers! What's wrong? I can't find the error.

MODULE K;

IMPORT Files, Stores, Out;

PROCEDURE write*;
VAR
    e: Stores.Writer;
     f: Files.File;
     i: INTEGER;
BEGIN
     f:=Files.dir.New(Files.dir.This(""), FALSE);
     e.ConnectTo(f);
     FOR i:=0 TO 10 DO
          e.WriteInt(i);
     END;
     f.Register("hola","txt", FALSE, i);
END write;

PROCEDURE read*;
VAR
     rd: Stores.Reader;
     f: Files.File;
     x, i: INTEGER;
BEGIN
     f:=Files.dir.Old(Files.dir.This(""), "hola.txt", TRUE);
     rd.ConnectTo(f); Out.Ln;
     WHILE ~rd.rider.eof DO
          rd.ReadInt(x);
          Out.Int(x,0); Out.Ln;
     END;
     f.Close;
END read;

END K.

--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy
Received on Fri Dec 14 2001 - 19:32:37 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:46 UTC