Connecting Tech Pros Worldwide Help | Site Map

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

  #1  
Old July 22nd, 2005, 12:25 PM
vj
Guest
 
Posts: n/a
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.
  #2  
Old July 22nd, 2005, 12:25 PM
Victor Bazarov
Guest
 
Posts: n/a

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