m_*********@hotmail.com wrote:
but how do I redirect its output into lets say
a vector of strings which I can examine from within my program.
Only with standard C++ facilities, you can't redirect the output
of called program directly: the only thing the standard C++
library supports is 'std::system()' which just calls the program
and returns the exit status. If you want redirection, you need
some interprocess communication stuff which is not covered by the
C++ standard.
On POSIX like machines you would use pipe(2), fork(2), some
variant of exec(2), and wait(2) to do redirect the input and or
the output of the spawned program. These operations are
encapsulated by some libraries, e.g. as a pipe stream. On other
systems you would use a similar approach but other system calls:
you need to ask for this in an appropriate environment specific
forum.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting