RedirectIOToConsole

Extrawurst spam at extrawurst.org
Wed May 28 15:31:42 PDT 2008


torhu schrieb:
> HANDLE lStdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
> hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
> fp = _fdopen( hConHandle, "w" );

this wont work, either. i had the same problem. for a reason i dont 
understand _fdopen( or fdopen like it is called in D) always returns a 
null-pointer. in this case all u have to to is to create a _iobuf 
instance yourself and set the _flag property to 2 (for "w" access) and 
the _file property to hConHandle. thats pretty much everything that 
_fdopen does in this case and it works.


More information about the Digitalmars-d-learn mailing list