delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/11/03:09:16

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Mime-Version: 1.0
X-Sender: valfer AT mbox DOT flashnet DOT it
Message-Id: <p06020406bc75cf677d72@[217.146.68.221]>
Date: Thu, 11 Mar 2004 09:11:22 +0100
To: cygwin AT cygwin DOT com
From: Valerio Ferrucci <valfer AT flashnet DOT it>
Subject: Win32 Redirect stdOut stdErr in same process

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 AT tabasoft DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019