[fpc-pascal]Redirecting StdOut

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Sat May 25 12:37:25 CEST 2002


On Fri, 24 May 2002, Rich Pasco wrote:

> Hi,
>
> Here's a simple Win32 console program which is supposed to demonstrate
> redirecting StdOut.  However the line "This should go to redout.txt"
> still goes to to the console.  Can anyout tell me what is wrong?

I think the problem is that the 'old' standard handle is still in use after
you switched the handle. The Output file variable still uses the old value.

It would be easier to simply do

  close(output);
  Assign(output,'somefile.txt');
  rewrite(output);

restoring it is then
  close(output);
  Assign(output,'');
  rewrite(output);

Michael.






More information about the fpc-pascal mailing list