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

V

vj

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.
 
V

Victor Bazarov

vj said:
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 ?

There is no way to do that in C++.
( command does cerr << errorcode; as part of its execution)

Can this be done without creating a file ?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top