can anyone give me more info on the system command? It allows you to execute dot exe programs from your code.

I am in particular looking for return values. 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?

Recommended Answers

All 2 Replies

>> 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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.