FILE * fp = popen("/bin/ls", "r");
char buf[100];
while (fgets(buf, sizeof(buf), fp)) {
printf("%s", buf);
}
pclose(fp);