Win32 Redirect stdOut stdErr in same process

Valerio Ferrucci valfer@flashnet.it
Thu Mar 11 12:25:00 GMT 2004


Errata corrige: in my previous mail I wrote stdIn where I wanted to mean stdOut

Hi,
I hope that someone on the list can help me about this or point me to 
some docs or example.
My Win32 application calls an external library that writes to stdOut 
and stdErr. I want to capture (redirect) these outputs (in order to 
send them back to the user via http). Note that I can't spawn another 
process because the library must run in the same process context of 
the caller.

On Unix my code is very simple:

int	fdOut[2]={-1, -1};
pipe(fdOut)
dup2(fdOut[1], STDOUT_FILENO)
... call the library
fcntl(fdOut[0], F_SETFL, fileFlags | O_NONBLOCK)
... read from fdOut[0]

Any idea on how to do this using Win32 API?
Any working example?

Thanks for help

-- 
==================================================================
Valerio Ferrucci                        Tabasoft Sas
ferrucci@tabasoft.it                    http://www.tabasoft.it

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list