Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site pixadv.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!harvard!wjh12!pixel!pixadv!cdr
From: cdr@pixadv.UUCP (cdr)
Newsgroups: net.lang.pascal
Subject: Re: Bug in 4.2 BSD Pascal implementation ???
Message-ID: <7@pixadv.UUCP>
Date: Tue, 2-Oct-84 16:57:36 EDT
Article-I.D.: pixadv.7
Posted: Tue Oct  2 16:57:36 1984
Date-Received: Thu, 4-Oct-84 04:42:39 EDT
References: <223@muddcs.UUCP>
Organization: Pixel Computer Inc., Wilmington, Mass.
Lines: 33

I'm not on a 4.2 system, but from what I can see of your "bug",
it's not one.

It seems that job of read is not to keep you out of the control 
characters but to only give you a printable char for whatever it was
that you did read, ie, a blank.

If you read past eoln and don't know it you'll get more than was
actually in the line.  That's why you only want to read til eoln
so you don't get blanks when read is trying to keep you from getting
into control chars.  As I understand Pascal, if you want to get past
eoln the classic way is "readln;" without any arguments.  Whatever
readln doesn't have buffer space for in the vars that you give it,
it is supposed to just junk.

Likewise, if you're interested in reading the real chars in a line,
don't use read but just "get" from the file pointer.

Dont forget that the file pointer is always pointing to the char that
you're about to read.  This would explain why it's "skipping a line".
What you've done is, with the read loop you got the file pointer on
the newline char, then with the "readln(C);" you got a blank
(substituted for the newline) in "C" and then readln did what it was
supposed to do after it loads the vars you've given it, it started
reading (and junking) characters til it found a newline.  One of readln's
jobs is to always leave the file pointer on the first char afterthe
newline it found in it's search.

-- 
____________________________________________________________________________
Constantine Rasmussen  (617) 657-8720 x2320
Pixel Computer Incorporated; 260 Fordham Road; Wilmington, Ma.  01887
{allegra|ihnp4|cbosgd|ima|genrad|amd|harvard} !wjh12!pixel!cdr