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

前端 未结 2 1242
遥遥无期
遥遥无期 2021-02-05 04:32

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

2条回答
  •  甜味超标
    2021-02-05 04:59

    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.

提交回复
热议问题