You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, September 30th 2011, 3:47pm

run system() command through qt application

Hi,

I cross compiled my qt application and it runs well on my arm development platform. What I want is to run a system() command when a button is pressed.I did something like follow in button's clicked() function.

Qstring command="cp -r /my_location1 /my_location2";
const char* command2;

command2 =command.toLocal8Bit().data();
system(command2);

this worked perfecly on my pc. but on target it didnt work.
I ran my application with ./my_app -qws command. can anyone help me

thank you.

2

Friday, September 30th 2011, 7:21pm

does "cp -r /my_location1 /my_location2" work on your target? system() is system dependant and is nothing at all to do with Qt
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

3

Saturday, October 1st 2011, 9:50am

Hi Amleto,

yes. It works perfectly in the command line in my target. And the qt application works perfectly in host computer as well. Problem is when I run the qt application in the target.

thank you.

4

Saturday, October 1st 2011, 11:11am

No idea. What is the difference between 'host' and 'target'?
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

5

Saturday, October 1st 2011, 7:45pm

Hi Amleto,

I could resolve the problem. It was a silly mistake. I had used "pushButton_clicked()" function to execute my command whereas it should have been "pushButton_pressed()" function. Now the system works perfectly. thank you for your advice. :)