#include main(){ FILE* fd; int i; char str[500]; fd=popen("ls -1|sort|grep .c","r"); while(fgets(str,500,fd)) printf("%s",str); printf("\n"); }