헤더파일 내용 생략

int global = 500;

 

int main(){

char *path = "bin/ls";

char *arg0 ="ls";

pid_t pid;

inf fd, status;

int local =10;

 

pid = fork()

if (pid==0) {

   printf("1");

   fd = open ("a.txt",o_sfjse,o_asldj)

  dup2(fd,stdout)

  close(fd);

 printf("2");

execl(path,arg0,null);

printf("3");

}

else{

close(fd);

wait(&status);

printf("4");

}

printf("5")

}

가 코듭니다 1,4,5,가 출력이됩니다 자식프로세스에서 왜 1이후론 출력이 불가능한가요