![Quote](images/misc/quote_icon.png)
Originally Posted by
musaulker
But what if I want to put a space between more than one arguments? (like: foobar.exe -foo bar foofoo)
You don't have to add spaces, because you pass parameters as a list.
parameters << "-foo" << "bar" << "foofoo";
parameters << "-foo" << "bar" << "foofoo";
To copy to clipboard, switch view to plain text mode
Spaces are necessary only when you pass program name and parameters as a single string (for example to QProcess::startDetached()).
![Quote](images/misc/quote_icon.png)
Originally Posted by
musaulker
The problem is probably because of escape characters. Sorry about the path. The true path is like:
C:\Documents and Settings\Administrator\foobar.exe
You have used the two-parameter version of QProcess::start(), so Qt probably understood it as run program "C:\Documents" with parameters "and" and "Settings\Administrator\foobar.exe".
Try:
programProcess
->start
( "c:\\...\\foobar.exe",
QStringList() );
// or if you want to add some parameters:
programProcess->start( "c:\\...\\foobar.exe", arguments );
programProcess->start( "c:\\...\\foobar.exe", QStringList() );
// or if you want to add some parameters:
programProcess->start( "c:\\...\\foobar.exe", arguments );
To copy to clipboard, switch view to plain text mode
or wrap that path in quotes:
programProcess->start( "\"c:\\...\\foobar.exe\"" );
programProcess->start( "\"c:\\...\\foobar.exe\"" );
To copy to clipboard, switch view to plain text mode
![Quote](images/misc/quote_icon.png)
Originally Posted by
musaulker
but I dont know if this is working proberly or not.
It's very unlikely that something is going to throw an integer at you. Better remove both try and catch clauses.
![Quote](images/misc/quote_icon.png)
Originally Posted by
musaulker
Is there a try/catch mechanism in QT library?
Exceptions are part of C++ language, but Qt itself doesn't throw any exceptions.
Bookmarks