problem with System()
-
@AlvaroS said:
sprintf(command, "%s %0.0f %0.0f 0 %0.0f %0.0f %s 0 0 +", princi,wps.front().x(), wps.front().y(),wps.back().x(),wps.back().y(),name_bmp)
What types are
princi
name_bmpbetter not be QStrings :)
-
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 ? -
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 ? -
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. -
/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. -
@AlvaroS So, if you enter /home/user1/princi in a terminal window and press enter it does not start? What happens? Any error message?
-
@jsulm In a terminal if I write
./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
in /home/user1/ directory it runs good
-
Ok, you must debug then
try to use
http://doc.qt.io/qt-5/qprocess.html#error
to see what it thinks. -
@jsulm In a terminal if I write
./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
in /home/user1/ directory it runs good
-
well you can use
qDebug() "qproc: " << myProcess->error();and check the code in
http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum