Quote:
Originally Posted by Ha1f
Hi all,
I'd like to know if this is possible. I'm writing a C++ program that I want to run bash scripts. The thing is, I'd like to be able to take the result of the script and use it as a value in my C++ program. For instance, if the script failed (either because of an error, or because it acheived a value within itself that would return a failure) I'd like the C++ program to be able to take that value and use it. Is this possible? If so, how?
Thanks
|
The easiest way would be to have your bash script emit the information you want from it to standard output or standard error. Then you could just use the normal C++ facilities to read from those streams.
There are other techniques for IPC (inter-process communication), but in *NIX environments, the standard streams are some of the simplest to work with.