Alex Rivera | Logout

How can I execute a command line command from a C++ program

Asked 2012-01-12T08:57:43.227
35

How can I execute the command line "asterisk -rx "reload"" in c++? Please help. I need an example. I am working on ubuntu server and I want to execute this command line from a user (inside a webservice).

Need help Appreciate

Edit
Report

1 Answer

6

system("asterisk -rx \"reload\"") would probably work, if you don't need standard output or error from the process.

If you need results from the process, here is an example of using C's popen(), or you could look at Boost.Process for a C++ approach.

answered 2012-01-12T09:00:06.230

Your Answer