[fpc-pascal] using popen() and assign/reset

Marco van de Voort marcov at stack.nl
Thu Nov 19 11:51:26 CET 2009


In our previous episode, Marc Santhoff said:
> 
> I'm trying to get unix.popen() running. The RTL.pdf says the file opened
> with popen (stdin for reading here) has to be reset or rewritten. The
> example does not do anything like that.

Apparantly that is false;

uses unix;

var
  f: text;
  s: ansistring;
begin
  s := '';
  popen(f, '/usr/bin/w', 'r');
//  reset(f);
  while not eof(f) do
  begin
    readln(f, s);
    writeln(s);
  end;
  close(f);
end.

works fine. Please file a bug against the documentation.




More information about the fpc-pascal mailing list