Passing Command line arguments to a Qt application in linux
Hi all,
I have a Qt application for which i have to pass some command line arguements to make it execute..is there any way to set the command line arguements programatically?
How can i achieve this?Anyone, plz help me in this regard.............
Is it possible to mention command line arguements while executing itself?
Regards,
Payal
Re: Passing Command line arguments to a Qt application in linux
Do you want to execute an application passing some arguments? Look at QProcess::start.
Do you want to get arguments passed to your application? Look at QCoreApplication::arguments.
Re: Passing Command line arguments to a Qt application in linux
yes payal , you can pass arguments from cmd line,
ex
Code:
int main(int argc, char *argv[])
{
if (args.count() != 2)
{
std::cerr << "argument required" << endl;
return 1;
}
myClass m; //ur class
m.test(args[1]); //pass cmd argument as function argument.
return app.exec();
}
hope it helpz
Bala
Re: Passing Command line arguments to a Qt application in linux
Thanks alot Bala..............
I am using QTCreator and i added command line arguements in Project settings.......So now its fine..........
Regards,
Payal