Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Is there a C++ equivalent of Java's Process.getOutputStream()?

Is there a way to get the stdin, stdout, and stderr streams of a process called by a C++ program, similar to Java's get*Stream() functions? I know about C++'s system(...) call but the only way I'm able to get the called process' output is by piping it to a file and then reading it back in, which is not an option in this case.

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    There is no way to do that in standard C++, and it is not possible for preexisting processes.

    You can do that using operating system specific system calls though, provided that it's your process that creates the other process.

    For Microsoft Windows, see: http://msdn.microsoft.com/en-us/library/ms682499(V...

    For POSIX systems (Unix, Linux, BSD, Mac OS), search for "popen".

    May be there is a portable library that encapsulate several operating systems in a single API.

  • ?
    Lv 4
    4 years ago

    Process Getoutputstream

Still have questions? Get your answers by asking now.