FILE *pf = popen("/home/norco/wh7/WH7_TVM/bin/getEventNo.sh","r"); char res[10240]; fread(res,10240,1,pf); printf("printf == %s\n",res); pclose(pf);@H_502_1@ getEventNo.sh: #!/bin/bash cat /proc/bus/input/devices 通过shell文件获取到devices文件内容后,将内容返回给C++代码。 ps:运行代码前要给shell文件加执行权限:chmod +xgetEventNo.sh
getEventNo.sh:
cat /proc/bus/input/devices
通过shell文件获取到devices文件内容后,将内容返回给C++代码。
ps:运行代码前要给shell文件加执行权限:chmod +xgetEventNo.sh