#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
//#include "apue.h"http://such file can not be found in window
int main(int argc, char *argv[])
{
DIR *dp;
struct dirent *dirp;
if(argc !=2)
{printf("usage :ls directory_name");system("PAUSE");
exit(1);
}
if((dp=opendir(argv[1]))==NULL)
{printf("cant open %s",argv[1]);system("PAUSE");
exit(1);
}
while((dirp=readdir(dp))!=NULL)
printf("%s\n",dirp->d_name);
closedir(dp);
system("PAUSE");
system("PAUSE");
return 0;
}


