#include <sys/types.h>
#include <dirent.h>
struct dirent *readdir(DIR *dirp);
01 #include <unistd.h>
02 #include <stdio.h>
03 #include <sys/types.h>
04 #include <dirent.h>
05
06 int main()
07 {
08 DIR *dp;
09 struct dirent *entry;
10
11 dp = opendir("/root/C");
12
13 while( (entry = readdir(dp)) != NULL )
14 printf("%s\\n",entry->d_name);
15
16 return 0;
17 }
[root@localhost C]# ./readdir.exe
readdir.exe
fileno.c
write.exe
read.exe
printf_test.exe
write.c
LSEEK
printdir.exe
read.c
readdir.c
new-1
..
fileno.exe
printdir.c
COPY
.
printf_test.c
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |