//返回值不等于0失败,等于0成功
static int ExcuteCmd(unsigned char *pcmd, unsigned char *pResult)
{
int ret=0;
int i =0;
unsigned char buffer[256]={0};
FILE *pFile = popen(pcmd,"r");
if(!pFile)
{
ret = -1;
goto exit;
}
while(!feof(pFile))
{
memset(buffer,0,sizeof(buffer));
if(fgets(buffer,256,pFile))
{
if(fgets(buffer,256,pFile))
{
strcat(pResult,buffer);
}
}
}
ret=pclose(pFile);
exit:
return ret;
}
阅读(1256) | 评论(0) | 转发(0) |