[fpc-pascal] re-opening stdout and sdterr

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Nov 13 20:57:34 CET 2008


On 13 Nov 2008, at 01:42, Marc Santhoff wrote:

> long time ago I had problems with stdxxx being in non-blocking i/o  
> mode.
> The suggestion was to close and re-open the channels from the system
> units init code.
>
> I ran into this problem again and would like to know:
>
> How can I close and reopen stderr and sdtout from my program?

close(stderr);
assign(stderr,'');
rewrite(stderr);

close(stdout);
assign(stdout,'');
rewrite(stdout);

This does not enable you to set any particular options on the  
descriptors though, and I'm not aware of any supported way for doing  
so (read: a way which is likely to be forward compatible). And even if  
you could get at the file descriptors, there is also no cross-platform  
functionality that I'm aware of to change their (non-)blocking setting.


Jonas



More information about the fpc-pascal mailing list