Connecting Tech Pros Worldwide Forums | Help | Site Map

equivalent of Java's getErrorStream in C++ - need to capture standard error

vj
Guest
 
Posts: n/a
#1: Jul 22 '05
I need to capture the error code put out by an executable which I run
from my program using

rc = system(command);

I get the stdout into rc. But how do I get to stderr ?
( command does cerr << errorcode; as part of its execution)

Can this be done without creating a file ?

Thanks in advance for your help.

Victor Bazarov
Guest
 
Posts: n/a
#2: Jul 22 '05

re: equivalent of Java's getErrorStream in C++ - need to capture standard error


vj wrote:[color=blue]
> I need to capture the error code put out by an executable which I run
> from my program using
>
> rc = system(command);
>
> I get the stdout into rc. But how do I get to stderr ?[/color]

There is no way to do that in C++.
[color=blue]
> ( command does cerr << errorcode; as part of its execution)
>
> Can this be done without creating a file ?[/color]

Yes, by using OS-specific means, like opening a pipe instead of using
'system', etc. Off-topic here, ask in a newsgroup for your OS.

Victor
Closed Thread