[fpc-pascal] FpDup2 dosen't work!

Linuxer Wang linuxerwang at gmail.com
Wed Oct 19 03:16:14 CEST 2005


Hi, all

I can't make FpDup2 work. Even the example provided by the document
can't work as well.
My system is fedora4 linux, freepascal 2.0.0 [2005/08/17] for i386.
Can anybody help me?
Thanks

program Example31;

{ Program to demonstrate the Dup function. }

uses BaseUnix;

var f : text;
i : longint;

begin
Assign (f,'text.txt');
Rewrite (F);
For i:=1 to 10 do writeln (F,'Line : ',i);
if fpdup2 (output,f)<>0 then
Writeln ('Dup2 Failed !'); //------------------------------ here, fpdup2
failed
writeln ('This is written to stdout.');
writeln (f,'This is written to the dup file, and flushed');
flush(f);
writeln;
{ Remove file. Comment this if you want to check flushing.}
fpUnlink ('text.txt');
end.




More information about the fpc-pascal mailing list