www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Win32: Console in GUI application

reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
In MS C++ I can create console window (e.g. for debugging purposes)
by using this:

      AllocConsole();
      freopen("conin$", "r", stdin);
      freopen("conout$", "w", stdout); // <- here is Win32 Exception 
exception in D
      freopen("conout$", "w", stderr);

The same trick in D generates Win32 Exception on third line.
I did test also
freopen("con", "w", stdout);
approach with the same negative result.

In fact I've solved this problem for myself by just not including .def file 
in the project
- so it runs as a console app from the very beginning.
But I would like to provide an option in runtime - on/off console.

Any ideas how to solve this?

Andrew.
Mar 18 2005
parent "Charles" <cee-lo green.com> writes:
-Lexet:NT for the linker


"Andrew Fedoniouk" <news terrainformatica.com> wrote in message
news:d1gfst$4po$1 digitaldaemon.com...
 In MS C++ I can create console window (e.g. for debugging purposes)
 by using this:

       AllocConsole();
       freopen("conin$", "r", stdin);
       freopen("conout$", "w", stdout); // <- here is Win32 Exception
 exception in D
       freopen("conout$", "w", stderr);

 The same trick in D generates Win32 Exception on third line.
 I did test also
 freopen("con", "w", stdout);
 approach with the same negative result.

 In fact I've solved this problem for myself by just not including .def
file
 in the project
 - so it runs as a console app from the very beginning.
 But I would like to provide an option in runtime - on/off console.

 Any ideas how to solve this?

 Andrew.
Mar 19 2005