Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

dirent.h

Go to the documentation of this file.
00001 /*
00002  * DIRENT.H (formerly DIRLIB.H)
00003  *
00004  * by M. J. Weinstein   Released to public domain 1-Jan-89
00005  *
00006  * Because I have heard that this feature (opendir, readdir, closedir)
00007  * it so useful for programmers coming from UNIX or attempting to port
00008  * UNIX code, and because it is reasonably light weight, I have included
00009  * it in the Mingw32 package. I have also added an implementation of
00010  * rewinddir, seekdir and telldir.
00011  *   - Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
00012  *
00013  *  This code is distributed in the hope that is will be useful but
00014  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00015  *  DISCLAMED. This includeds but is not limited to warranties of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017  *
00018  * $Revision: 1.1.4.1.4.1 $
00019  * $Author: pphaneuf $
00020  * $Date: 2003/11/20 16:24:42 $
00021  *
00022  */
00023 
00024 #ifndef __STRICT_ANSI__
00025 
00026 #ifndef _DIRENT_H_
00027 #define _DIRENT_H_
00028 
00029 #include <io.h>
00030 
00031 #ifndef RC_INVOKED
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 struct dirent
00038 {
00039         long            d_ino;          /* Always zero. */
00040         unsigned short  d_reclen;       /* Always zero. */
00041         unsigned short  d_namlen;       /* Length of name in d_name. */
00042         char*           d_name;         /* File name. */
00043         /* NOTE: The name in the dirent structure points to the name in the
00044          *       finddata_t structure in the DIR. */
00045 };
00046 
00047 /*
00048  * This is an internal data structure. Good programmers will not use it
00049  * except as an argument to one of the functions below.
00050  */
00051 typedef struct
00052 {
00053         /* disk transfer area for this dir */
00054         struct _finddata_t      dd_dta;
00055 
00056         /* dirent struct to return from dir (NOTE: this makes this thread
00057          * safe as long as only one thread uses a particular DIR struct at
00058          * a time) */
00059         struct dirent           dd_dir;
00060 
00061         /* _findnext handle */
00062         long                    dd_handle;
00063 
00064         /*
00065          * Status of search:
00066          *   0 = not started yet (next entry to read is first entry)
00067          *  -1 = off the end
00068          *   positive = 0 based index of next entry
00069          */
00070         short                   dd_stat;
00071 
00072         /* given path for dir with search pattern (struct is extended) */
00073         char                    dd_name[1];
00074 } DIR;
00075 
00076 
00077 DIR*            opendir (const char*);
00078 struct dirent*  readdir (DIR*);
00079 int             closedir (DIR*);
00080 void            rewinddir (DIR*);
00081 long            telldir (DIR*);
00082 void            seekdir (DIR*, long);
00083 
00084 #ifdef  __cplusplus
00085 }
00086 #endif
00087 
00088 #endif  /* Not RC_INVOKED */
00089 
00090 #endif  /* Not _DIRENT_H_ */
00091 
00092 #endif  /* Not __STRICT_ANSI__ */
00093 

Generated on Sat Mar 13 14:55:15 2004 for WvStreams by doxygen 1.3.6-20040222