popen命令的封装
1.源码
int runShellNoReturn(const char *cmd, const char *mode)
{
FILE *file = popen(cmd, mode);
if (file == NULL)
{
return 1;
}
else
{
pclose(file);
return 0;
}
}
FILE *runShellAndReturn(const char *cmd, const char *mode)
{
FILE *file = popen(cmd, mode);
if (file == NULL)
{
return NULL;
}
else
{
return file;
}
}
2.函数解析
函数很简单。无须多言。
标签:const,--,cmd,popen,char,coc,file,return From: https://www.cnblogs.com/yuxiannana/p/17564336.html