如何在std = c99时使用exec/kill?

Mar*_*oma 1 c c99

当我尝试使用exec时:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>


int main()
{
    exec("echo `Hello World`");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

code.c:11: error: implicit declaration of function ‘exec’
make: *** [code.o] Error 1
Run Code Online (Sandbox Code Playgroud)

我必须使用std = c99,我不能添加任何其他编译器标志.我怎样才能使用exec(或同一个电话)?

我猜解决方案对于杀人来说是一样的,不是吗?

Jac*_*oyd 5

基于您的包含,看起来您正在使用某种类型的Unix.没有exec电话.还有execl,exexlp和其他与根据确切类型的参数名称.有关详细信息,请查看'exec'的手册页.