[fpc-pascal] using popen() and assign/reset
Marc Santhoff
M.Santhoff at web.de
Thu Nov 19 11:24:30 CET 2009
Hello,
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.
The other part is the question whether the file has to be assign()'ed
befor or not.
var
f: text;
s: ansistring;
begin
s := '';
popen(f, '/usr/bin/w', 'r');
reset(f);
readln(f, s);
close(f);
writeln(s);
end;
Using it that way does not work, it prints an empty string. Leaving out
reset does the same.
Running the command on the command line does actually print out
something (one line).
What's wrong here?
--
Marc Santhoff <M.Santhoff at web.de>
More information about the fpc-pascal
mailing list