🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #653

HELP! seq textfile reading screwy...

#653
From: PAUL E. GANTER
Date: Fri, 13 Apr 1990 03:03
40 lines
1365 bytes
Help, please!

I am trying to read sequential text files on my Amiga using
Benchmark Modula 2.  I prefer to read a whole line at a time,
so I wrote a ReadLine procedure.  When I repeatedly call it,
it reads the same (first) line of the text file!  I am NOT
reopening the file or using SetPos between ReadLine's.

If you have any idea why this is happening, please help!

ReadLine is something like:

   x := 0
   repeat
     readchar(infile,ch)
     line[x] := ch
     inc(x)
   until infile.eof or ch = lf
   line[x] := char(0)

It seems to work okay on the first line.  WriteString will show the
first line as expected.

The calling code is something like:


   repeat
     readline(in,ln)
     writestring(ln)
          .
          .
          .
  until in.eof

---------------------------------------------------------------------
Please e-mail help, as I don't normally read this group!

Thanks!

--Paul                 peg@psuecl.bitnet  or  peg@psuecl.psu.edu
Technical Details
Message-ID: <104612@psuecl.bitnet>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!brutus.cs.uiuc.edu!wuarchive!psuvax1!psuvm!psuecl!peg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!brutus.cs.uiuc.edu!wuarchive!psuvax1!psuvm!psuecl!peg
From: peg@psuecl.bitnet (PAUL E. GANTER)
Newsgroups: comp.lang.modula2
Subject: HELP! seq textfile reading screwy...
Message-ID: <104612@psuecl.bitnet>
Date: 13 Apr 90 03:03:52 GMT
Organization: Engineering Computer Lab, Pennsylvania State University
Lines: 40