Jonas Stein wrote:
i want to write an gui (an applet for Kicker in KDE) for a shellcommand in
qt3/c++.
So i need to call an executable and get its output back into my c++ program.
what would be the correct way to implement this?
I'm glad for links and any helpful hints.
If you need to interact with a program that reads and/or writes to the
standard io ports you need to use pipes. Basically you fork, start
your new program, and override the standard io ports for the new
program to pipes, and you connect to those pipes in the GUI and then
interact with them. It isn't all that hard, but it isn't always that
easy either. Both programs need to be written so they don't get frozen
up when buffering isn't quite what is expected. You'll need to make
sure to flush all lines in the console program for instance and never
leave anything partially read.
There is no C++ standard way to do it but there are standard ways to do
it. Most systems implement posix. Windows is likely to of course be
different.
I have a project that does it in C++ using Qt on the GUI side and
standard C++ on the other:
http://xiangqi-engine.sourceforge.net