Date: Sun, 19 Jul 1998 14:00:11 +0300 (IDT) From: Eli Zaretskii To: Jorge Ivan Meza Martinez cc: djgpp AT delorie DOT com Subject: Re: read stderr In-Reply-To: <01bdb1c5$1f278800$0a1f1bc4@default> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Fri, 17 Jul 1998, Jorge Ivan Meza Martinez wrote: > I use system to launch a child program, > it generates stdout and stderr, > I am interested in take this data to be shown in my program, > how can I do that in a portable way ? If you only need to capture stdout, use `popen' and `pclose' instead of `system'. If you need stderr as well, you will need to redirect handle 2 to a file (using `dup'/`open'/`dup2' paradigm) before you call either `system' or `popen', and then read the redirected output from the file after the child process returns. All of the functions mentioned above are fairly portable.