Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use a similar technique on Windows, you just need to use different words for the same concepts. :) This article: <a href="http://msdn.microsoft.com/en-us/library/ms682499.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms682499.aspx</a> uses a win32 pipe to handle I/O from another process, you just have to do the same thing with threads within the same process. Of course, in your case all output to stderr from anywhere in the process will be redirected to your consumer.</p> <p>Actually, other pieces of the puzzle you may need are <a href="http://msdn.microsoft.com/en-us/library/dye30d82(VS.80).aspx" rel="noreferrer">_fdopen</a> and <a href="http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx" rel="noreferrer">_open_osfhandle</a>. In fact, here's a related example from some <a href="http://hewgill.com/pilot/copilot/" rel="noreferrer">code</a> I released years ago:</p> <pre><code>DWORD CALLBACK DoDebugThread(void *) { AllocConsole(); SetConsoleTitle("Copilot Debugger"); // The following is a really disgusting hack to make stdin and stdout attach // to the newly created console using the MSVC++ libraries. I hope other // operating systems don't need this kind of kludge.. :) stdout-&gt;_file = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT); stdin-&gt;_file = _open_osfhandle((long)GetStdHandle(STD_INPUT_HANDLE), _O_TEXT); debug(); stdout-&gt;_file = -1; stdin-&gt;_file = -1; FreeConsole(); CPU_run(); return 0; } </code></pre> <p>In this case, the main process was a GUI process which doesn't start with stdio handles at all. It opens a console, then shoves the right handles into stdout and stdin so the debug() function (which was designed as a stdio interactive function) can interact with the newly created console. You should be able to open some pipes and do the same sort of thing to redirect stderr.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload