[fpc-pascal]Reading from stdin-pipe (bug?).

Arne Hanssen nite at c2i.net
Sat May 17 11:23:19 CEST 2003


Consider this code and tell me if this is a bug (under win32):
--------------------------------------------------------------------
Program RedirTest;
var
  textstr: string;
  begin
    while not eof( input ) do begin
    readln( input, textstr );    // No, using 'read()' won't do! ;-)
    writeln( 'Read: ', textstr );
  end;
end.
--------------------------------------------------------------------

When input is piped to this program under Win32 (Win2K) error 109 is
given:
--------------------------------------------------------------------
[...]
Free Pascal Compiler version 1.0.6 [2002/04/23] for i386
Target OS: Win32 for i386
[...]
d:\>echo Testing | redirtest
Read: Testing
Runtime error 109 at 0x004010B0
  0x004010B0
  0x00401109
--------------------------------------------------------------------

Adding DOS' EOF-marker (^Z) resolves the problem:
--------------------------------------------------------------------
d:\>echo Testing^Z | redirtest
Testing
--------------------------------------------------------------------

Linux is ok:
--------------------------------------------------------------------
Free Pascal Compiler version 1.0.6 [2002/04/30] for i386
Target OS: Linux for i386

[arne at ws1 temp]$ echo "Testing" | redirtest
Read: Testing
--------------------------------------------------------------------

-- 
Vennlig hilsen / Best regards
Arne Hanssen




More information about the fpc-pascal mailing list