Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-05

Reading from stdin-pipe (bug?).

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Arne Hanssen
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

temp]$ echo "Testing" | redirtest
Read: Testing
--------------------------------------------------------------------

Vennlig hilsen / Best regards Arne Hanssen

Reply by email

Unknown author
to Arne Hanssen
Arne Hanssen wrote 26 lines
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 --------------------------------------------------------------------

I think (but I'm not sure) that this is caused by a patch applied by Pierre Muller some time ago to the Win32 version of handling standard input.

Michael.

Reply by email