[root@ test]$ cat return10.c
#include <stdio.h>
int main(int argc, char *argv[]){
return 10;
}
[root@ test]$ perl -e 'print system("/path_to_return10")'
2560
Run Code Online (Sandbox Code Playgroud)
我期待10但是得到2560,为什么?
system在perl中调用的文档中指定(http://perldoc.perl.org/functions/system.html):
返回值是等待调用返回的程序的退出状态.要获得实际退出值,请向右移动八(见下文).
确实: 2560 >> 8 = 10
| 归档时间: |
|
| 查看次数: |
283 次 |
| 最近记录: |