PDA

View Full Version : executing terminal command in c/c++ applications



u04f061
May 28th, 2007, 02:40 AM
can anybody tell me how to run terminal commands in C/C++ programs. Does Qt provides any facility to do this? please give me some resources links (tutorials etc) related to it.

yabbadabbadont
May 28th, 2007, 03:07 AM
man 3 system
You will probably need to have the manpages-dev package installed for that to work. Also read up on the "spawn" series of library functions.

u04f061
May 28th, 2007, 03:12 AM
man 3 system

what is man 3 system?
I only kno how to open man(1) page by simply typing man app_name

plz tell me how to open man 3

yabbadabbadont
May 28th, 2007, 03:17 AM
man man will answer your question.... :D

Short answer, just type it into a terminal window, hit enter, read. ;)

u04f061
May 28th, 2007, 03:39 AM
thanks done it.

seamless
May 28th, 2007, 06:19 AM
can anybody tell me how to run terminal commands in C/C++ programs. Does Qt provides any facility to do this? please give me some resources links (tutorials etc) related to it.
Qt provides full support using QProcess (http://doc.trolltech.com/4.2/qprocess.html). You will probably want to use the startDetached (http://doc.trolltech.com/4.2/qprocess.html#startDetached) function otherwise spawned command will be killed when your application exits.

u04f061
May 28th, 2007, 11:14 AM
Qt provides full support using QProcess. You will probably want to use the startDetached function otherwise spawned command will be killed when your application exits.

thanks. that is what i was looking for.