problem with System()
-
This is not really an answer to your question but still related: You should consider using the QProcess class. This is not only a lot more flexible & portable than the
system()
function but also integrates well into the Qt framework (signal&slots, properties, ...).
Usually you want to use Qt library components wherever possible.To still be somewhat useful: Did you check that
command
is large enough and that the string assembled bysprintf()
is correct?Edit: @SGaist played ninja again....
-
Then run your application through the debugger.
-
@SGaist Now I do this:
QString program = "./home/princi"; QStringList arguments; arguments << "0" << QString::number(wps.front().x()) << QString::number(wps.front().y()) << "0" << QString::number(wps.back().x()) << QString::number(wps.back().y()) << "prueba_princi.bmp" << "0 0 +" ; QProcess myProcess; myProcess.start(program,arguments);
it compiles good but my application does not run...
-
You call it with a path relative to where you main application is started.
./home/princi
is equivalent to$PWD/home/princi/
which is likely not what you want, is it ? -
@SGaist Now I do this and nothing as well..
QString program = "princi"; QStringList arguments; arguments << "0" << QString::number(wps.front().x()) << QString::number(wps.front().y()) << "0" << QString::number(wps.back().x()) << QString::number(wps.back().y()) << "prueba_princi.bmp" << "0 0 +" ; QString folder = "/home/"; QProcess *myProcess = new QProcess(this); myProcess->setWorkingDirectory(folder); myProcess->start(program,arguments);
-
What is the full path to
princi
? And what is the full path to your application ? -
/home is not the full path to your application except it is called home and is located in the root directory.
So, you can start the program in a shell with /home/princi?
Did you try it?
This is quite strange path: in /home you usually have a directory for each user and /home is not writable by normal user. -
Ok, you must debug then
try to use
http://doc.qt.io/qt-5/qprocess.html#error
to see what it thinks. -