char buf[256]={0};
char cmd[64] ={0};
FILE *fp=NULL;
snprintf(cmd,sizeof(cmd),"ls %s","/aaa/");
fp=popen(cmd,"r");
int readlen=fread(buf,1,sizeof[buf],fp);
pclose(fp);
readlen和buf即为所求
char buf[256]={0};
char cmd[64] ={0};
FILE *fp=NULL;
snprintf(cmd,sizeof(cmd),"ls %s","/aaa/");
fp=popen(cmd,"r");
int readlen=fread(buf,1,sizeof[buf],fp);
pclose(fp);
readlen和buf即为所求