home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / io.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  7KB  |  260 lines

  1. /***
  2. *io.h - declarations for low-level file handling and I/O functions
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       This file contains the function declarations for the low-level
  8. *       file handling and I/O functions.
  9. *
  10. *       [Public]
  11. *
  12. ****/
  13.  
  14. #if     _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17.  
  18. #ifndef _INC_IO
  19. #define _INC_IO
  20.  
  21. #if     !defined(_WIN32) && !defined(_MAC)
  22. #error ERROR: Only Mac or Win32 targets supported!
  23. #endif
  24.  
  25.  
  26. #ifdef  _MSC_VER
  27. /*
  28.  * Currently, all MS C compilers for Win32 platforms default to 8 byte
  29.  * alignment.
  30.  */
  31. #pragma pack(push,8)
  32. #endif  /* _MSC_VER */
  33.  
  34. #ifndef _POSIX_
  35.  
  36. #ifdef  __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40.  
  41.  
  42. /* Define _CRTIMP */
  43.  
  44. #ifndef _CRTIMP
  45. #ifdef  _DLL
  46. #define _CRTIMP __declspec(dllimport)
  47. #else   /* ndef _DLL */
  48. #define _CRTIMP
  49. #endif  /* _DLL */
  50. #endif  /* _CRTIMP */
  51.  
  52.  
  53. /* Define __cdecl for non-Microsoft compilers */
  54.  
  55. #if     ( !defined(_MSC_VER) && !defined(__cdecl) )
  56. #define __cdecl
  57. #endif
  58.  
  59. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  60.  
  61. #ifndef _CRTAPI1
  62. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  63. #define _CRTAPI1 __cdecl
  64. #else
  65. #define _CRTAPI1
  66. #endif
  67. #endif
  68.  
  69. #ifndef _MAC
  70. #ifndef _WCHAR_T_DEFINED
  71. typedef unsigned short wchar_t;
  72. #define _WCHAR_T_DEFINED
  73. #endif
  74. #endif  /* ndef _MAC */
  75.  
  76. #ifndef _TIME_T_DEFINED
  77. typedef long time_t;            /* time value */
  78. #define _TIME_T_DEFINED         /* avoid multiple def's of time_t */
  79. #endif
  80.  
  81. #ifndef _FSIZE_T_DEFINED
  82. typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
  83. #define _FSIZE_T_DEFINED
  84. #endif
  85.  
  86. #ifndef _MAC
  87.  
  88. #ifndef _FINDDATA_T_DEFINED
  89.  
  90. struct _finddata_t {
  91.     unsigned    attrib;
  92.     time_t      time_create;    /* -1 for FAT file systems */
  93.     time_t      time_access;    /* -1 for FAT file systems */
  94.     time_t      time_write;
  95.     _fsize_t    size;
  96.     char        name[260];
  97. };
  98.  
  99. #if     _INTEGRAL_MAX_BITS >= 64
  100. struct _finddatai64_t {
  101.     unsigned    attrib;
  102.     time_t      time_create;    /* -1 for FAT file systems */
  103.     time_t      time_access;    /* -1 for FAT file systems */
  104.     time_t      time_write;
  105.     __int64     size;
  106.     char        name[260];
  107. };
  108. #endif
  109.  
  110. #define _FINDDATA_T_DEFINED
  111. #endif
  112.  
  113. #ifndef _WFINDDATA_T_DEFINED
  114.  
  115. struct _wfinddata_t {
  116.     unsigned    attrib;
  117.     time_t      time_create;    /* -1 for FAT file systems */
  118.     time_t      time_access;    /* -1 for FAT file systems */
  119.     time_t      time_write;
  120.     _fsize_t    size;
  121.     wchar_t     name[260];
  122. };
  123.  
  124. #if     _INTEGRAL_MAX_BITS >= 64
  125. struct _wfinddatai64_t {
  126.     unsigned    attrib;
  127.     time_t      time_create;    /* -1 for FAT file systems */
  128.     time_t      time_access;    /* -1 for FAT file systems */
  129.     time_t      time_write;
  130.     __int64     size;
  131.     wchar_t     name[260];
  132. };
  133. #endif
  134.  
  135. #define _WFINDDATA_T_DEFINED
  136. #endif
  137.  
  138. /* File attribute constants for _findfirst() */
  139.  
  140. #define _A_NORMAL       0x00    /* Normal file - No read/write restrictions */
  141. #define _A_RDONLY       0x01    /* Read only file */
  142. #define _A_HIDDEN       0x02    /* Hidden file */
  143. #define _A_SYSTEM       0x04    /* System file */
  144. #define _A_SUBDIR       0x10    /* Subdirectory */
  145. #define _A_ARCH         0x20    /* Archive file */
  146.  
  147. #endif  /* ndef _MAC */
  148.  
  149. /* function prototypes */
  150.  
  151. _CRTIMP int __cdecl _access(const char *, int);
  152. _CRTIMP int __cdecl _chmod(const char *, int);
  153. _CRTIMP int __cdecl _chsize(int, long);
  154. _CRTIMP int __cdecl _close(int);
  155. _CRTIMP int __cdecl _commit(int);
  156. _CRTIMP int __cdecl _creat(const char *, int);
  157. _CRTIMP int __cdecl _dup(int);
  158. _CRTIMP int __cdecl _dup2(int, int);
  159. _CRTIMP int __cdecl _eof(int);
  160. _CRTIMP long __cdecl _filelength(int);
  161. #ifndef _MAC
  162. _CRTIMP long __cdecl _findfirst(const char *, struct _finddata_t *);
  163. _CRTIMP int __cdecl _findnext(long, struct _finddata_t *);
  164. _CRTIMP int __cdecl _findclose(long);
  165. #endif  /* ndef _MAC */
  166. _CRTIMP int __cdecl _isatty(int);
  167. _CRTIMP int __cdecl _locking(int, int, long);
  168. _CRTIMP long __cdecl _lseek(int, long, int);
  169. _CRTIMP char * __cdecl _mktemp(char *);
  170. _CRTIMP int __cdecl _open(const char *, int, ...);
  171. #ifndef _MAC
  172. _CRTIMP int __cdecl _pipe(int *, unsigned int, int);
  173. #endif  /* ndef _MAC */
  174. _CRTIMP int __cdecl _read(int, void *, unsigned int);
  175. _CRTIMP int __cdecl remove(const char *);
  176. _CRTIMP int __cdecl rename(const char *, const char *);
  177. _CRTIMP int __cdecl _setmode(int, int);
  178. _CRTIMP int __cdecl _sopen(const char *, int, int, ...);
  179. _CRTIMP long __cdecl _tell(int);
  180. _CRTIMP int __cdecl _umask(int);
  181. _CRTIMP int __cdecl _unlink(const char *);
  182. _CRTIMP int __cdecl _write(int, const void *, unsigned int);
  183.  
  184. #if     _INTEGRAL_MAX_BITS >= 64
  185. _CRTIMP __int64 __cdecl _filelengthi64(int);
  186. _CRTIMP long __cdecl _findfirsti64(const char *, struct _finddatai64_t *);
  187. _CRTIMP int __cdecl _findnexti64(long, struct _finddatai64_t *);
  188. _CRTIMP __int64 __cdecl _lseeki64(int, __int64, int);
  189. _CRTIMP __int64 __cdecl _telli64(int);
  190. #endif
  191.  
  192. #ifndef _MAC
  193. #ifndef _WIO_DEFINED
  194.  
  195. /* wide function prototypes, also declared in wchar.h  */
  196.  
  197. _CRTIMP int __cdecl _waccess(const wchar_t *, int);
  198. _CRTIMP int __cdecl _wchmod(const wchar_t *, int);
  199. _CRTIMP int __cdecl _wcreat(const wchar_t *, int);
  200. _CRTIMP long __cdecl _wfindfirst(const wchar_t *, struct _wfinddata_t *);
  201. _CRTIMP int __cdecl _wfindnext(long, struct _wfinddata_t *);
  202. _CRTIMP int __cdecl _wunlink(const wchar_t *);
  203. _CRTIMP int __cdecl _wrename(const wchar_t *, const wchar_t *);
  204. _CRTIMP int __cdecl _wopen(const wchar_t *, int, ...);
  205. _CRTIMP int __cdecl _wsopen(const wchar_t *, int, int, ...);
  206. _CRTIMP wchar_t * __cdecl _wmktemp(wchar_t *);
  207.  
  208. #if     _INTEGRAL_MAX_BITS >= 64
  209. _CRTIMP long __cdecl _wfindfirsti64(const wchar_t *, struct _wfinddatai64_t *);
  210. _CRTIMP int __cdecl _wfindnexti64(long, struct _wfinddatai64_t *);
  211. #endif
  212.  
  213. #define _WIO_DEFINED
  214. #endif
  215. #endif  /* ndef _MAC */
  216.  
  217.  
  218. _CRTIMP long __cdecl _get_osfhandle(int);
  219. _CRTIMP int __cdecl _open_osfhandle(long, int);
  220.  
  221. #if     !__STDC__
  222.  
  223. /* Non-ANSI names for compatibility */
  224.  
  225. _CRTIMP int __cdecl access(const char *, int);
  226. _CRTIMP int __cdecl chmod(const char *, int);
  227. _CRTIMP int __cdecl chsize(int, long);
  228. _CRTIMP int __cdecl close(int);
  229. _CRTIMP int __cdecl creat(const char *, int);
  230. _CRTIMP int __cdecl dup(int);
  231. _CRTIMP int __cdecl dup2(int, int);
  232. _CRTIMP int __cdecl eof(int);
  233. _CRTIMP long __cdecl filelength(int);
  234. _CRTIMP int __cdecl isatty(int);
  235. _CRTIMP int __cdecl locking(int, int, long);
  236. _CRTIMP long __cdecl lseek(int, long, int);
  237. _CRTIMP char * __cdecl mktemp(char *);
  238. _CRTIMP int __cdecl open(const char *, int, ...);
  239. _CRTIMP int __cdecl read(int, void *, unsigned int);
  240. _CRTIMP int __cdecl setmode(int, int);
  241. _CRTIMP int __cdecl sopen(const char *, int, int, ...);
  242. _CRTIMP long __cdecl tell(int);
  243. _CRTIMP int __cdecl umask(int);
  244. _CRTIMP int __cdecl unlink(const char *);
  245. _CRTIMP int __cdecl write(int, const void *, unsigned int);
  246.  
  247. #endif  /* __STDC__ */
  248.  
  249. #ifdef  __cplusplus
  250. }
  251. #endif
  252.  
  253. #endif  /* _POSIX_ */
  254.  
  255. #ifdef  _MSC_VER
  256. #pragma pack(pop)
  257. #endif  /* _MSC_VER */
  258.  
  259. #endif  /* _INC_IO */
  260.