problem with System()
-
@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. -
-
well you can use
qDebug() "qproc: " << myProcess->error();and check the code in
http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum