home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / INC.PAK / DIRENT.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  3KB  |  123 lines

  1. /*  dirent.h
  2.  
  3.     Definitions for POSIX directory operations.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.5
  9.  *
  10.  *      Copyright (c) 1991, 1994 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #ifndef __DIRENT_H
  16. #define __DIRENT_H
  17.  
  18. #if !defined(___DEFS_H)
  19. #include <_defs.h>
  20. #endif
  21.  
  22. #ifndef NULL
  23. #include <_null.h>
  24. #endif
  25.  
  26. #if defined(__WIN32__)
  27. #include <windows.h>  /* For WIN32_FIND_DATA */
  28. #endif
  29.  
  30.  
  31. #if !defined(RC_INVOKED)
  32.  
  33. #if defined(__STDC__)
  34. #pragma warn -nak
  35. #endif
  36.  
  37. #pragma option -a-
  38.  
  39. #endif  /* !RC_INVOKED */
  40.  
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46.  
  47. /* dirent structure returned by readdir().
  48.  */
  49. struct dirent
  50. {
  51. #if defined(__OS2__)
  52.     char        d_name[256];
  53. #elif defined(__WIN32__) || defined(__DPMI32__)
  54.     char        d_name[260];
  55. #else
  56.     char        d_name[13];
  57. #endif
  58. };
  59.  
  60. #if !defined(__FLAT__)
  61.  
  62. /* _DIR type returned by _opendir().  The first two members cannot
  63.  * be separated, because they make up the DOS DTA structure used
  64.  * by _findfirst() and _findnext().
  65.  */
  66. typedef struct
  67. {
  68.     char           _d_reserved[30];      /* reserved part of DTA */
  69.     struct dirent  _d_dirent;            /* filename part of DTA */
  70.     char    _FAR  *_d_dirname;           /* directory name */
  71.     char           _d_first;             /* first file flag */
  72.     unsigned char  _d_magic;             /* magic cookie for verifying handle */
  73. } DIR;
  74.  
  75. #else    /* defined __FLAT__ */
  76.  
  77.  
  78. /* DIR type returned by opendir().  The members of this structure
  79.  * must not be accessed by application programs.
  80.  */
  81. typedef struct
  82. {
  83.     unsigned long _d_hdir;              /* directory handle */
  84.     char         *_d_dirname;           /* directory name */
  85.     unsigned      _d_magic;             /* magic cookie for verifying handle */
  86.     unsigned      _d_nfiles;            /* no. of files remaining in buf */
  87. #if defined(__OS2__)
  88.     char         *_d_bufp;              /* next entry in buffer */
  89.     char          _d_buf[512];          /* buffer for found filenames */
  90. #endif
  91. #if defined(__WIN32__)
  92.     char          _d_buf[sizeof(WIN32_FIND_DATA)];  /* buffer for a single file */
  93. #endif
  94. } DIR;
  95.  
  96. #endif  /* __FLAT__ */
  97.  
  98. /* Prototypes.
  99.  */
  100. DIR            _FAR * _RTLENTRY _EXPFUNC opendir  (const char _FAR *__dirname);
  101. struct dirent  _FAR * _RTLENTRY _EXPFUNC readdir  (DIR _FAR *__dir);
  102. int                   _RTLENTRY _EXPFUNC closedir (DIR _FAR *__dir);
  103. void                  _RTLENTRY _EXPFUNC rewinddir(DIR _FAR *__dir);
  104.  
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108.  
  109.  
  110. #if !defined(RC_INVOKED)
  111.  
  112. #pragma option -a. /* restore default packing  */
  113.  
  114. #if defined(__STDC__)
  115. #pragma warn .nak
  116. #endif
  117.  
  118. #endif  /* !RC_INVOKED */
  119.  
  120.  
  121. #endif  /* __DIRENT_H */
  122.  
  123.