home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / bloodshed / devcpp-4.9.9.2_setup.exe / dirent.h < prev    next >
C/C++ Source or Header  |  2005-01-29  |  3KB  |  124 lines

  1. /*
  2.  * DIRENT.H (formerly DIRLIB.H)
  3.  * This file has no copyright assigned and is placed in the Public Domain.
  4.  * This file is a part of the mingw-runtime package.
  5.  * No warranty is given; refer to the file DISCLAIMER within the package.
  6.  *
  7.  */
  8. #ifndef _DIRENT_H_
  9. #define _DIRENT_H_
  10.  
  11. /* All the headers include this file. */
  12. #include <_mingw.h>
  13.  
  14. #include <io.h>
  15.  
  16. #ifndef RC_INVOKED
  17.  
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21.  
  22. struct dirent
  23. {
  24.     long        d_ino;        /* Always zero. */
  25.     unsigned short    d_reclen;    /* Always zero. */
  26.     unsigned short    d_namlen;    /* Length of name in d_name. */
  27.     char        d_name[FILENAME_MAX]; /* File name. */
  28. };
  29.  
  30. /*
  31.  * This is an internal data structure. Good programmers will not use it
  32.  * except as an argument to one of the functions below.
  33.  * dd_stat field is now int (was short in older versions).
  34.  */
  35. typedef struct
  36. {
  37.     /* disk transfer area for this dir */
  38.     struct _finddata_t    dd_dta;
  39.  
  40.     /* dirent struct to return from dir (NOTE: this makes this thread
  41.      * safe as long as only one thread uses a particular DIR struct at
  42.      * a time) */
  43.     struct dirent        dd_dir;
  44.  
  45.     /* _findnext handle */
  46.     long            dd_handle;
  47.  
  48.     /*
  49.          * Status of search:
  50.      *   0 = not started yet (next entry to read is first entry)
  51.      *  -1 = off the end
  52.      *   positive = 0 based index of next entry
  53.      */
  54.     int            dd_stat;
  55.  
  56.     /* given path for dir with search pattern (struct is extended) */
  57.     char            dd_name[1];
  58. } DIR;
  59.  
  60. DIR* __cdecl opendir (const char*);
  61. struct dirent* __cdecl readdir (DIR*);
  62. int __cdecl closedir (DIR*);
  63. void __cdecl rewinddir (DIR*);
  64. long __cdecl telldir (DIR*);
  65. void __cdecl seekdir (DIR*, long);
  66.  
  67.  
  68. /* wide char versions */
  69.  
  70. struct _wdirent
  71. {
  72.     long        d_ino;        /* Always zero. */
  73.     unsigned short    d_reclen;    /* Always zero. */
  74.     unsigned short    d_namlen;    /* Length of name in d_name. */
  75.     wchar_t        d_name[FILENAME_MAX]; /* File name. */
  76. };
  77.  
  78. /*
  79.  * This is an internal data structure. Good programmers will not use it
  80.  * except as an argument to one of the functions below.
  81.  */
  82. typedef struct
  83. {
  84.     /* disk transfer area for this dir */
  85.     struct _wfinddata_t    dd_dta;
  86.  
  87.     /* dirent struct to return from dir (NOTE: this makes this thread
  88.      * safe as long as only one thread uses a particular DIR struct at
  89.      * a time) */
  90.     struct _wdirent        dd_dir;
  91.  
  92.     /* _findnext handle */
  93.     long            dd_handle;
  94.  
  95.     /*
  96.          * Status of search:
  97.      *   0 = not started yet (next entry to read is first entry)
  98.      *  -1 = off the end
  99.      *   positive = 0 based index of next entry
  100.      */
  101.     int            dd_stat;
  102.  
  103.     /* given path for dir with search pattern (struct is extended) */
  104.     wchar_t            dd_name[1];
  105. } _WDIR;
  106.  
  107.  
  108.  
  109. _WDIR* __cdecl _wopendir (const wchar_t*);
  110. struct _wdirent*  __cdecl _wreaddir (_WDIR*);
  111. int __cdecl _wclosedir (_WDIR*);
  112. void __cdecl _wrewinddir (_WDIR*);
  113. long __cdecl _wtelldir (_WDIR*);
  114. void __cdecl _wseekdir (_WDIR*, long);
  115.  
  116.  
  117. #ifdef    __cplusplus
  118. }
  119. #endif
  120.  
  121. #endif    /* Not RC_INVOKED */
  122.  
  123. #endif    /* Not _DIRENT_H_ */
  124.