According to Sven Engelhardt:
The compiled program "eats up" the first char if standard input is not a terminal. This is because when `Input' is `reset' at startup, the first char is read in to `Input's file buffer variable. If you would `read' the char rather than `getchar'ring it, you would get it.
To work around, use the `eoln' function to check whether a char has been read in like this:
program test1(input,output);
function getchar:integer; C;
var k:integer;
begin
if not eoln ( Input ) then k:= ord ( Input^ ) else
k:=getchar;
while (k<>-1) do begin writeln(k); k:=getchar; end; end.
To fix this bug (?) it would be necessary to rewrite parts of the RTS, but I am not sure whether we should do that because I can imagine that GPC's behaviour is as the ISO Standard requires. (But I am not in the position to judge that. ;-)
Hope this helps,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201] maintainer GNU Pascal [970401] - http://home.pages.de/~gnu-pascal/ [970125]