🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #654

HELP! seq. textfile reading screwy...

#654
From: PAUL E. GANTER
Date: Fri, 13 Apr 1990 03:30
34 lines
1167 bytes
Help, please!

I am trying to read a sequential text file in Benchmark Modula 2
on an Amiga.  I wante dto read a whole line at a time, so I wrote
a ReadLine procedure (below).  When I call this routine repeatedly,
the same (first) line is read from the file each time.  Can
anyone explain why this is?  I am not reopening the file each time,
or using SetPos between ReadLine's.

ReadLine is something like:

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

the calling code is now (i simplified it):

repeat
  readline(file,ln)
  writestring(ln)
  check for control c to save my butt!
until file.eof


Please e-mail any help, since I don't normally read this.

Thanks!

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

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