branch update for HEAD-2003021201
[reactos.git] / include / msvcrt / dir.h
1 /*
2  * dir.h
3  *
4  * Functions for working with directories and path names.
5  * This file OBSOLESCENT and only provided for backward compatibility.
6  * Please use io.h instead.
7  *
8  * This file is part of the Mingw32 package.
9  *
10  * Contributors:
11  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
12  *
13  *  THIS SOFTWARE IS NOT COPYRIGHTED
14  *
15  *  This source code is offered for use in the public domain. You may
16  *  use, modify or distribute it freely.
17  *
18  *  This code is distributed in the hope that it will be useful but
19  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
20  *  DISCLAIMED. This includes but is not limited to warranties of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22  *
23  * $Revision$
24  * $Author$
25  * $Date$
26  *
27  */
28
29 #ifndef __STRICT_ANSI__
30
31 #ifndef _DIR_H_
32 #define _DIR_H_
33
34 #include <msvcrt/stdio.h>   /* To get FILENAME_MAX... ugly. */
35 #include <msvcrt/sys/types.h>   /* To get time_t. */
36
37 #ifdef  __cplusplus
38 extern "C" {
39 #endif
40
41 /*
42  * Attributes of files as returned by _findfirst et al.
43  */
44 #define _A_NORMAL   0x00000000
45 #define _A_RDONLY   0x00000001
46 #define _A_HIDDEN   0x00000002
47 #define _A_SYSTEM   0x00000004
48 #define _A_VOLID    0x00000008
49 #define _A_SUBDIR   0x00000010
50 #define _A_ARCH     0x00000020
51
52 #ifndef _FSIZE_T_DEFINED
53 typedef unsigned long   _fsize_t;
54 #define _FSIZE_T_DEFINED
55 #endif
56
57 /*
58  * The following structures are filled in by _findfirst or _findnext when
59  * they succeed in finding a match.
60  */
61 struct _finddata_t
62 {
63     unsigned    attrib;     /* Attributes, see constants above. */
64     time_t      time_create;
65     time_t      time_access;    /* always midnight local time */
66     time_t      time_write;
67     _fsize_t    size;
68     char        name[FILENAME_MAX]; /* may include spaces. */
69 };
70
71 struct _finddatai64_t
72 {
73     unsigned    attrib;     /* Attributes, see constants above. */
74     time_t      time_create;
75     time_t      time_access;    /* always midnight local time */
76     time_t      time_write;
77     __int64     size;
78     char        name[FILENAME_MAX]; /* may include spaces. */
79 };
80
81 struct _wfinddata_t
82 {
83     unsigned    attrib;     /* Attributes, see constants above. */
84     time_t      time_create;
85     time_t      time_access;    /* always midnight local time */
86     time_t      time_write;
87     _fsize_t    size;
88     wchar_t     name[FILENAME_MAX]; /* may include spaces. */
89 };
90
91 struct _wfinddatai64_t
92 {
93     unsigned    attrib;     /* Attributes, see constants above. */
94     time_t      time_create;
95     time_t      time_access;    /* always midnight local time */
96     time_t      time_write;
97     __int64     size;
98     wchar_t     name[FILENAME_MAX]; /* may include spaces. */
99 };
100
101 /*
102  * Functions for searching for files. _findfirst returns -1 if no match
103  * is found. Otherwise it returns a handle to be used in _findnext and
104  * _findclose calls. _findnext also returns -1 if no match could be found,
105  * and 0 if a match was found. Call _findclose when you are finished.
106  */
107 int _findclose(int nHandle);
108 int _findfirst(const char* szFilespec, struct _finddata_t* find);
109 int _findnext(int nHandle, struct _finddata_t* find);
110 int _findfirsti64(const char* szFilespec, struct _finddatai64_t* find);
111 int _findnexti64(int nHandle, struct _finddatai64_t* find);
112 /* Wide character versions */
113 int _wfindfirst(const wchar_t *_name, struct _wfinddata_t *result);
114 int _wfindfirsti64(const wchar_t *_name, struct _wfinddatai64_t *result);
115 int _wfindnext(int handle, struct _wfinddata_t *result);
116 int _wfindnexti64(int handle, struct _wfinddatai64_t *result);
117
118 int _chdir(const char* szPath);
119 char* _getcwd(char* caBuffer, int nBufferSize);
120 int _mkdir(const char* szPath);
121 char* _mktemp(char* szTemplate);
122 int _rmdir(const char* szPath);
123
124 /* Wide character versions */
125 int _wchdir(const wchar_t *szPath);
126 wchar_t* _wgetcwd(wchar_t *buffer, int maxlen);
127 int _wmkdir(const wchar_t *_path);
128 wchar_t* _wmktemp(wchar_t *_template);
129 int _wrmdir(const wchar_t *_path);
130
131
132 #ifndef _NO_OLDNAMES
133
134 int chdir(const char* szPath);
135 char* getcwd(char* caBuffer, int nBufferSize);
136 int mkdir(const char* szPath);
137 char* mktemp(char* szTemplate);
138 int rmdir(const char* szPath);
139
140 #endif /* Not _NO_OLDNAMES */
141
142
143 #ifdef  __cplusplus
144 }
145 #endif
146
147 #endif  /* Not _DIR_H_ */
148
149 #endif  /* Not __STRICT_ANSI__ */