通过shell获取文件内容并返回给代码
发布时间:2020-12-15 09:24:15 所属栏目:安全 来源:网络整理
导读:FILE *pf = popen("/home/norco/wh7/WH7_TVM/bin/getEventNo.sh","r");char res[10240];fread(res,10240,1,pf);printf("printf == %sn",res);pclose(pf); getEventNo.sh: #!/bin/bash cat /proc/bus/input/devices 通过shell文件获取到devices文件内容后,
FILE *pf = popen("/home/norco/wh7/WH7_TVM/bin/getEventNo.sh","r"); char res[10240]; fread(res,10240,1,pf); printf("printf == %sn",res); pclose(pf);
getEventNo.sh: #!/bin/bashcat /proc/bus/input/devices
通过shell文件获取到devices文件内容后,将内容返回给C++代码。 ps:运行代码前要给shell文件加执行权限:chmod +xgetEventNo.sh (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |