>> Can one get the system function to let the called program write its output to a
>> variable instead of writting it in the command window?
Yes. But AFAIK it would be useless because that variable would be part of the shell (assuming you're on Unix) that executes teh cmd and this shell will be destroyed when system returns.
It might be better if you would make the program write the return code to a flat file, which you would be able to read later.
thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
you can make it write the output to a file and then your program will have access to it. Or instead of system() use pipe() and your program can read the program's output into a variable such as a character buffer.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343