c++ calls bash

hi, i'm a noob
i have a quuestion: is possible to call and run the bash script by c++ program?
if so, is it posible in grafic? specially Qt ?
thanks

Have you tried the system() function?

Regards

and what si the parameter? way to file? it doesn't works:-/

The parameter is the command, program or script you want to run:

system("scriptname");

ph man you're God...
thanks so much...

sir,
and if i have script that can be runned only by root, so i need to write something like "sudo" or "su"before script, how could I run it from c++ ? (with or withnout password.. )
that's my last question, i promise

In fact you can use the system command to run every command. Have a read of the sudo manual:

Sudo Manual

Regards

I'm sorry, i didn't expess as good as i wanted..
i want to run : ppd call tm4g (that calls T-mobile and give me internet)
in terminal i have to use sudo,
by System() is it unrunable, because i'm not logged as root... how could I bring root rigts to my program?

Hi.

As Franklin says, you can run anything using system:

With password:

/home/oracle/tmp > cat main.c
void main( void ) {
  system( "su - -c pwd" );
}
/home/oracle/tmp > ./main
Password: ********
/root

Without password you need to configure sudo for your user to use the program you want to run as root (including any programs that will run which only root could normally run).