I am writing an application in C++ (Qt creator application), and I have embedded a call to an external AVRDUDE script. The script executes perfectly, however control is returned to the spawning C++ program immediately after the call, and NOT upon completion. here is the function call
void MainWindow::call_AVRDUDE_read() {
QProcess CommandPrompt;
QStringList Arguments;
Arguments <<"C/ avrdude -c arduino -P com3 -b 115200 -p ATmega328P -e -U eeprom:r:fromEEPROM.bin:r";
CommandPrompt.startDetached("cmd",Arguments);
The script runs fine and does exactly as it should, but reading the EEPROM of course takes a few seconds to execute the task. In the meantime, control has been returned to the c++ program which spawned the AVRDUDE script and is off trying to evaluate the contents of "fromEEPROM.bin" prior to its arrival. I know this to be true as I have placed a breakpoint in the code shortly after the call to the AVRDUDE read function. The breakpoint is hit immediately after the call to the above script.
So the crux of the problem is how to suspend execution of the calling code while the AVRDUDE script is in process. Then, when the EEPROM read is completed, return control to the host process so it can proceed with its process.
One last thing: I did try inserting "CommandPrompt.waitForFinished();" in the above function at the tail end, but it did nothing. Any thoughts?