我有一个C程序,它调用一个AWK脚本,该脚本返回退出代码0或1.但是,当AWK脚本的退出代码为1时,我的C程序中对system
的调用返回256.这些文件记录在哪里?这个值是依赖于系统还是总是转换为255+1?
$ cat test.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int exitCode;
exitCode = system("awk '{ exit 0 }' test.c");
printf("%d\n", exitCode);
exitCode = system("awk '{ exit 1 }' test.c");
printf("%d\n", exitCode);
return 0;
}
$ gcc -o test -Wall test.c
$ ./test
0
256