Connecting Tech Pros Worldwide Help | Site Map

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

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 22nd, 2005, 11:25 AM
vj
Guest
 
Posts: n/a
Default equivalent of Java's getErrorStream in C++ - need to capture standard error

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, 11:25 AM
Victor Bazarov
Guest
 
Posts: n/a
Default Re: equivalent of Java's getErrorStream in C++ - need to capturestandard 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.