Sign in Join

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

Mailing lists / fpc-devel / 2005-10

FpDup2 dosen't work!

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Linuxer Wang

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.

Reply by email