int main(int argc, char *argv[])
{
char buf[128];
FILE *pp;
if( (pp = popen("ls -al", "r")) == NULL )
{
printf("popen() error!\n");
exit(1);
}
while(fgets(buf, sizeof buf, pp))
{
printf("%s", buf);
}
pclose(pp);
return 0;
}
阅读(1067) | 评论(0) | 转发(0) |