Windows / redirect STDERR to see assert messages

Robert M. Münch robert.muench at saphirion.com
Sun May 12 13:39:15 UTC 2019


When developing Windows GUI applications I use:

      // detach from console and attach to a new one, works for x86 and x86_64
      FreeConsole();
      AllocConsole();

      freopen("CONIN$", "r", stdin);
      freopen("CONOUT$", "w", stdout);
      freopen("CONOUT$", "w", stderr);

so that the GUI app opens a console for writeln() output etc. I assumed 
this should work for assert() messages as well. But it seems it 
doesn't. If an assert fails, I don't see any output. Is assert using 
something else? What's wrong about this approach?

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list