readdir.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef READDIR_H
  2. #define READDIR_H
  3. /*
  4. * Structures and types used to implement opendir/readdir/closedir
  5. * on Windows 95/NT.
  6. */
  7. #include <windows.h>
  8. #include <io.h>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <sys/types.h>
  12. #include <direct.h>
  13. /* struct dirent - same as Unix */
  14. struct dirent {
  15. long d_ino; /* inode (always 1 in WIN32) */
  16. off_t d_off; /* offset to this dirent */
  17. unsigned short d_reclen; /* length of d_name */
  18. char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
  19. };
  20. /* typedef DIR - not the same as Unix */
  21. typedef struct {
  22. HANDLE handle; /* _findfirst/_findnext handle */
  23. short offset; /* offset into directory */
  24. short finished; /* 1 if there are not more files */
  25. WIN32_FIND_DATA fileinfo; /* from _findfirst/_findnext */
  26. char *dir; /* the dir we are reading */
  27. struct dirent dent; /* the dirent to return */
  28. } DIR;
  29. /* Function prototypes */
  30. DIR *opendir(const char *);
  31. struct dirent *readdir(DIR *);
  32. int readdir_r(DIR *, struct dirent *, struct dirent **);
  33. int closedir(DIR *);
  34. int rewinddir(DIR *);
  35. #endif /* READDIR_H */