#include <unistd.h>
#include <
stdio.h>
void child_process()
{
while (true)
{
printf("I am child process\n");
}
}
int main()
{
pid_t pid = fork();
if (pid < 0)
{
printf("fork error! exit\n");
}
if (pid == 0) //子进程
{
child_process();
return 0;
}
else //父进程
{
//父进程要执行的内容
}
return 0;
}