所以我试图从我正在制作的 ac 文件中调用一个程序,但我能够做到这一点的唯一方法是使用 system() 函数,它本身会导致错误。在我使用的终端中运行程序;
~/odas/bin/odaslive -vc ~/odas/config/odaslive/matrix_creator.cfg
这就是我目前试图用来运行同一个程序的程序,它可以编译并将在终端中运行,但没有任何反应。
pid_t pid=fork();
if (pid==0){
//static char *argv[] ={"echo","-vc ~/odas/config/odaslive/matrix_creator.cfg", NULL};
execl("~/odas/bin", "~/odas/bin/odaslive", "-vc", "~/odas/config/odaslive/matrix_creator.cfg", (char *)NULL);
exit(127);
} else {
waitpid(pid,0,0);
}