pclose返回值为什么要和256比较
include <errno.h>
include <stdio.h>
include <stdlib.h>
include <string.h>
include <unistd.h>
int main(int argc, char *argv[])
{
int status;
pid_t pid;pid = fork(); if (0 == pid) { exit(atoi(argv[1])); } else { wait(&status); printf("status = %d\n", status); if (WIFEXITED(status)) { printf("WEXITSTATUS(status)=%d\n", WEXITSTATUS(status)); } } return 0;
}
该程序运行结果