Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site oddjob.UUCP Path: utzoo!linus!philabs!prls!amdimage!amdcad!amd!pesnta!hplabs!intelca!qantel!ihnp4!oddjob!paul From: paul@oddjob.UUCP (Paul Schinder) Newsgroups: net.lang.mod2,net.micro.mac Subject: Help wanted with ETHZ Mac Modula-2 Compiler: How do you detect EOF? Message-ID: <888@oddjob.UUCP> Date: Sat, 27-Jul-85 20:56:07 EDT Article-I.D.: oddjob.888 Posted: Sat Jul 27 20:56:07 1985 Date-Received: Tue, 30-Jul-85 05:21:40 EDT Reply-To: paul@oddjob.UUCP (Paul Schinder) Followup-To: net.micro.mac Organization: U. Chicago, Astronomy & Astrophysics Lines: 30 Xref: linus net.lang.mod2:222 net.micro.mac:2155 Since the arrival of the entire ETHZ Modula-2 compiler for the Macintosh, I've been spending some time learning Modula-2 and playing with the compiler. My intent is to do some data analysis on my Mac (finally I can use the Mac for something other than editing or as a terminal!). Since the distributed version doesn't come with an InFile module corresponding to the OutTerminal/OutFile pair, I decided to try to write a simple module to read fixed format real numbers from a file on the disk. As a test, I wrote a small program which reads a file from the disk and puts it on the screen, repetitivly using the ReadChar routine in M2Files to read the file. The problem is that I can't figure out how to detect the end-of-file. A loop like "WHILE NOT EndFile(file) DO ..." results in nothing being read (as, surprisingly, does WHILE EndFile(file) DO ..., i.e. it's not just a matter of the wrong result being passed back from EndFile). If I loop a fixed number of times, the program works just fine except that it continues trying to read even after the entire file has been read. This doesn't cause the Mac to crash, it's just an annoyance. If anyone has figured out how to properly detect EOF (or if someone from ETHZ feels like telling me), I'd appreciate it. I'd like to thank ETHZ for making the compiler available to the USENET, and for the way it was posted (this was the first large posting from Europe that arrived here intact!). -- Paul Schinder Astronomy and Astrophysics Center University of Chicago uucp: ..!ihnp4!oddjob!paul arpa: oddjob!paul@lbl-csam.arpa