关于-sh: ./popen: not found问题
以下是源码:#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
main()
{
FILE * fd;
char *cmd={"ps"};
char buf;
buf='\0';
if((fd=popen(cmd,"r"))==0) {printf("popen error");exit;}
while((fgets(buf,1000,fd))!=NULL)
printf("%s",buf);
pclose(fd);
}
内核使用2.6.12,使用4.4.3编译内核和一上源码,使用arm-linux-gcc -o popen popen.c编译后chmod +x popen增加权限后运行提示-sh: ./popen: not found
使用arm-linux-gcc -static -o popen popen.c编译后chmod +x popen增加权限后运行提示Segmentation fault~~
怎么解决~~求解~~~
Ps:以上代码在电脑上gcc编译后运行正常~~ 用3.4.1的是没有任何提示跳过~~
# ./popen
#
#
#
页:
[1]