I have exactly this problem described here: http://stackoverflow.com/questions/1...achable-or-not but the solution provided didn't solve my problem. I am at a linux machine as the guy who had the similar problem. In fact the code is like this:
params << "-c" << "1" << "http://www.google.com";
connected->start(exec,params);
if(!connected->waitForFinished())
return false;
cout << "The exit code is " << connected->exitCode() << endl;
delete connected;
QProcess *connected = new QProcess(0);
QString exec="ping";
QStringList params;
params << "-c" << "1" << "http://www.google.com";
connected->start(exec,params);
if(!connected->waitForFinished())
return false;
cout << "The exit code is " << connected->exitCode() << endl;
delete connected;
To copy to clipboard, switch view to plain text mode
The ping process does execute and I always get the value '2' returned from connected->exitCode(). I have no idea why, but if I place instead of google.com the actual IP of google.com it seems to return the code correctly. But I don't know if google has static IP or not and I don't want to risk it anyway... Any suggestions or tips why is this happening and how to fix it
?
Bookmarks