>>592
/*とりあえずファイル一覧を表示するプログラム*/
/*参考:http://www.wakhok.ac.jp/~maruyama/Syscall/inode/section3.5.html*/
#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc,char *argv[]){
struct dirent *dir = NULL;
DIR *dp = NULL;

if(argc != 2){
printf("usage:\t%s [dir_path]\n",argv[0]);
return 1;
}
if(NULL == (dp = opendir(argv[1]))){
printf("cannot open \"%s\"\n",argv[1]);
return 1;
}
while(NULL != (dir = readdir(dp))){
printf("%s ",dir->d_name);
}
printf("\n");
closedir(dp);
return 0;
}