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

Sounds like a trivial use-case for the system() function:

system("asterisk -rx reload");

If you need very fine-grained control of the child process there are better ways, but this is simple to get going.

This call starts a shell (such as bash) to run the command, which is why I removed the quotes around reload; they’re pointless for a single word and will be removed by the shell and never seen by the started program, anyway.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)