home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / io.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  11.3 KB  |  353 lines

  1. /*  io.h
  2.  
  3.     Definitions for low level I/O functions.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 10.0
  9.  *
  10.  *      Copyright (c) 1987, 2000 by Inprise Corporation
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. /* $Revision:   9.13  $ */
  16.  
  17. #ifndef __IO_H
  18. #define __IO_H
  19.  
  20. #ifndef ___STDDEF_H
  21. #include <_stddef.h>
  22. #endif
  23.  
  24. #if !defined(___NFILE_H)
  25. #include <_nfile.h>
  26. #endif
  27.  
  28. #if !defined(RC_INVOKED)
  29.  
  30. #if defined(__STDC__)
  31. #pragma warn -nak
  32. #endif
  33.  
  34. #pragma pack(push, 1)
  35.  
  36. #endif  /* !RC_INVOKED */
  37.  
  38. #ifdef __cplusplus
  39. namespace std {
  40. #endif
  41.  
  42. extern  unsigned    _RTLENTRY _EXPDATA _nfile;
  43.  
  44. #define HANDLE_MAX   (_NFILE_)
  45. struct  ftime   {
  46.     unsigned    ft_tsec  : 5;   /* Two second interval */
  47.     unsigned    ft_min   : 6;   /* Minutes */
  48.     unsigned    ft_hour  : 5;   /* Hours */
  49.     unsigned    ft_day   : 5;   /* Days */
  50.     unsigned    ft_month : 4;   /* Months */
  51.     unsigned    ft_year  : 7;   /* Year */
  52. };
  53.  
  54. #define SEEK_CUR    1
  55. #define SEEK_END    2
  56. #define SEEK_SET    0
  57.  
  58. #ifndef  _TIME_T
  59. typedef long time_t;
  60. #ifdef __cplusplus
  61. #  define _TIME_T std::time_t
  62. #else
  63. #  define _TIME_T time_t
  64. #endif /* __cplusplus */
  65. #endif
  66.  
  67. /* MSC names for file attributes */
  68.  
  69. #define _A_NORMAL   0x00        /* Normal file, no attributes */
  70. #define _A_RDONLY   0x01        /* Read only attribute */
  71. #define _A_HIDDEN   0x02        /* Hidden file */
  72. #define _A_SYSTEM   0x04        /* System file */
  73. #define _A_VOLID    0x08        /* Volume label */
  74. #define _A_SUBDIR   0x10        /* Directory */
  75. #define _A_ARCH     0x20        /* Archive */
  76.  
  77. #ifndef MAXPATH
  78. #define MAXPATH   260
  79. #define MAXDIR    256
  80. #define MAXFILE   256
  81. #define MAXEXT    256
  82. #define MAXDRIVE    3
  83. #endif
  84.  
  85. /* MSC names for functions */
  86.  
  87. #define _access(_a,_b)      access(_a,_b)
  88. #define _eof(_a)            eof(_a)
  89.  
  90. /* Microsoft C compatible findfirst() data types */
  91.  
  92. #if defined (_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS >= 64) && !defined(__STDC__)
  93. struct _wfinddatai64_t {
  94.         unsigned attrib;
  95.         _TIME_T  time_create;   /* -1 for FAT file systems */
  96.         _TIME_T  time_access;   /* -1 for FAT file systems */
  97.         _TIME_T  time_write;
  98.         __int64  size;
  99.         wchar_t  name[MAXPATH];
  100. };
  101.  
  102. struct _finddatai64_t {
  103.         unsigned attrib;
  104.         _TIME_T  time_create;   /* -1 for FAT file systems */
  105.         _TIME_T  time_access;   /* -1 for FAT file systems */
  106.         _TIME_T  time_write;
  107.         __int64  size;
  108.         char     name[MAXPATH];
  109. };
  110. #endif /* _INTEGRAL_MAX_BITS */
  111.  
  112. struct _wfinddata_t {
  113.         unsigned attrib;
  114.         _TIME_T  time_create;   /* -1 for FAT file systems */
  115.         _TIME_T  time_access;   /* -1 for FAT file systems */
  116.         _TIME_T  time_write;
  117.         long     size;
  118.         wchar_t  name[MAXPATH];
  119. };
  120.  
  121. struct _finddata_t {
  122.         unsigned attrib;
  123.         _TIME_T  time_create;   /* -1 for FAT file systems */
  124.         _TIME_T  time_access;   /* -1 for FAT file systems */
  125.         _TIME_T  time_write;
  126.         long     size;
  127.         char     name[MAXPATH];
  128. };
  129.  
  130. #ifdef __cplusplus
  131. extern "C" {
  132. #endif
  133. int  _RTLENTRY _EXPFUNC access  (const char _FAR *__path, int __amode);
  134. #ifdef __IN_CHMOD
  135. int  _RTLENTRY _EXPFUNC _rtl_chmod  ();
  136. int  _RTLENTRY _EXPFUNC _chmod  ();
  137. #else
  138. int  _RTLENTRY _EXPFUNC _rtl_chmod (const char _FAR *__pathname, int __func, ... );
  139. int  _RTLENTRY _EXPFUNC _chmod     (const char _FAR *__pathname, int __func, ... );
  140. #endif
  141. int  _RTLENTRY _EXPFUNC chmod   (const char _FAR *__path, int __amode);
  142. int  _RTLENTRY _EXPFUNC chsize  (int __handle, long __size);
  143. int  _RTLENTRY _EXPFUNC _rtl_close  (int __handle);
  144. int  _RTLENTRY _EXPFUNC _close  (int __handle);
  145. int  _RTLENTRY _EXPFUNC close   (int __handle);
  146. int  _RTLENTRY _EXPFUNC _rtl_creat  (const char _FAR *__path, int __attribute);
  147. int  _RTLENTRY _EXPFUNC _creat  (const char _FAR *__path, int __attribute);
  148. int  _RTLENTRY _EXPFUNC creat   (const char _FAR *__path, int __amode);
  149. int  _RTLENTRY _EXPFUNC creatnew(const char _FAR *__path, int __mode); /* DOS 3.0 or later */
  150. int  _RTLENTRY _EXPFUNC creattemp(char _FAR *__path, int __amode); /* DOS 3.0 or later */
  151. int  _RTLENTRY _EXPFUNC dup   (int __handle);
  152. int  _RTLENTRY _EXPFUNC dup2  (int __oldhandle, int __newhandle);
  153. int  _RTLENTRY _EXPFUNC eof     (int __handle);
  154. long _RTLENTRY _EXPFUNC filelength(int __handle);
  155. int  _RTLENTRY _EXPFUNC getftime(int __handle, struct ftime _FAR *__ftimep);
  156.  
  157. #if defined (_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS >= 64) && !defined(__STDC__)
  158. long _RTLENTRY _EXPFUNC _wfindfirsti64(wchar_t *, struct _wfinddatai64_t *);
  159. long _RTLENTRY _EXPFUNC _wfindnexti64(long, struct _wfinddatai64_t *);
  160. long _RTLENTRY _EXPFUNC _findfirsti64(char *, struct _finddatai64_t *);
  161. long _RTLENTRY _EXPFUNC _findnexti64(long, struct _finddatai64_t *);
  162. #endif /* _INTEGRAL_MAX_BITS */
  163.  
  164. long _RTLENTRY _EXPFUNC __wfindfirst(wchar_t *, struct _wfinddata_t *);
  165. long _RTLENTRY _EXPFUNC __wfindnext(long, struct _wfinddata_t *);
  166. long _RTLENTRY _EXPFUNC _findfirst(char *, struct _finddata_t *);
  167. long _RTLENTRY _EXPFUNC _findnext(long, struct _finddata_t *);
  168.  
  169. int _RTLENTRY _EXPFUNC _findclose(long);
  170.  
  171. int  _RTLENTRY _EXPFUNC _waccess   (const wchar_t *__path, int __amode);
  172. int  _RTLENTRY _EXPFUNC _wchmod    (const wchar_t *__path, int __amode);
  173. int  _RTLENTRY _EXPFUNC _wrtl_chmod(const wchar_t *__pathname, int __func, ... );
  174. int  _RTLENTRY _EXPFUNC _wcreat    (const wchar_t *__path, int __amode);
  175. int  _RTLENTRY _EXPFUNC _wrtl_creat(const wchar_t *__path, int __attribute);
  176. int  _RTLENTRY _EXPFUNC _wunlink   (const wchar_t *__path);
  177. int  _RTLENTRY _EXPFUNC _wremove   (const wchar_t * __path);
  178. int  _RTLENTRY _EXPFUNC _wrename   (const wchar_t *__oldname,const wchar_t *__newname);
  179. int  _RTLENTRY _EXPFUNC _wrtl_open (const wchar_t *__path, int __oflags);
  180. wchar_t   * _RTLENTRY  _EXPFUNC     _wmktemp(wchar_t *__template);
  181.  
  182. long _RTLENTRY  _EXPFUNC _get_osfhandle(int __handle);
  183. int  _RTLENTRY  _EXPFUNC _open_osfhandle(long __osfhandle, int __oflag);
  184.  
  185. #ifdef __IN_IOCTL
  186. int  _RTLENTRY           ioctl   ();
  187. #else
  188. int  _RTLENTRY _EXPFUNC ioctl   (int __handle, int __func, ...);
  189.         /* optional 3rd and 4th args are: void _FAR * __argdx, int argcx */
  190. #endif
  191.  
  192. int  _RTLENTRY _EXPFUNC isatty (int __handle);
  193. int  _RTLENTRY _EXPFUNC lock   (int __handle, long __offset, long __length);
  194. int  _RTLENTRY _EXPFUNC locking(int __handle, int __mode, long __length);
  195. long _RTLENTRY _EXPFUNC lseek  (int __handle, long __offset, int __fromwhere);
  196. char * _RTLENTRY _EXPFUNC   _mktemp(char *__template );
  197.  
  198. #ifdef __IN_OPEN
  199. int  _RTLENTRY _EXPFUNC open  ();
  200. int  _RTLENTRY _EXPFUNC _wopen  ();
  201. #else
  202. int  _RTLENTRY _EXPFUNC open  (const char _FAR *__path, int __access,... /*unsigned mode*/);
  203. #endif
  204. int  _RTLENTRY _EXPFUNC _wopen(const wchar_t *__path, int __access,... /*unsigned mode*/);
  205. int  _RTLENTRY _EXPFUNC _rtl_open (const char _FAR *__path, int __oflags);
  206. int  _RTLENTRY _EXPFUNC _open (const char _FAR *__path, int __oflags);
  207. int  _RTLENTRY _EXPFUNC read  (int __handle, void _FAR *__buf, unsigned __len);
  208. int  _RTLENTRY _EXPFUNC _rtl_read (int __handle, void _FAR *__buf, unsigned __len);
  209. int  _RTLENTRY _EXPFUNC _read (int __handle, void _FAR *__buf, unsigned __len);
  210. int  _RTLENTRY _EXPFUNC remove(const char _FAR *__path);
  211. int  _RTLENTRY _EXPFUNC rename(const char _FAR *__oldname,const char _FAR *__newname);
  212. int  _RTLENTRY  _EXPFUNC setftime(int __handle, struct ftime _FAR *__ftimep);
  213. int  _RTLENTRY  _EXPFUNC setmode(int __handle, int __amode);
  214.  
  215. #ifdef __IN_SOPEN
  216. int  _RTLENTRY  _EXPFUNC _sopen ();
  217. int  _RTLENTRY  _EXPFUNC _wsopen ();
  218. #else
  219. int  _RTLENTRY  _EXPFUNC _sopen (const char *__path, int __access, int __shflag,
  220.                       ... /* unsigned mode */);
  221. int  _RTLENTRY  _EXPFUNC _wsopen (const wchar_t *__path, int __access, int __shflag,
  222.                       ... /* unsigned mode */);
  223. #endif
  224. long _RTLENTRY _EXPFUNC tell  (int __handle);
  225. unsigned _RTLENTRY      umask (unsigned __cmask);
  226. int  _RTLENTRY _EXPFUNC unlink(const char _FAR *__path);
  227. int  _RTLENTRY _EXPFUNC unlock(int __handle, long __offset, long __length);
  228. int  _RTLENTRY _EXPFUNC _rtl_write(int __handle, const void _FAR *__buf, unsigned __len);
  229. int  _RTLENTRY _EXPFUNC _commit(int __handle);
  230. int  _RTLENTRY _EXPFUNC _write(int __handle, const void _FAR *__buf, unsigned __len);
  231. int  _RTLENTRY _EXPFUNC write (int __handle, const void _FAR *__buf, unsigned __len);
  232. #if !defined(__STDC__)
  233. char  * _RTLENTRY _EXPFUNC mktemp( char *__template );
  234. #ifdef __IN_SOPEN
  235. int  _RTLENTRY _EXPFUNC sopen ();
  236. #else
  237. int  _RTLENTRY _EXPFUNC sopen (const char *__path, int __access, int __shflag,
  238.                       ... /* unsigned mode */);
  239. #endif /* __IN_SOPEN */
  240. #endif /* __STDC__ */
  241.  
  242. #define _lseek(__handle, __offset, __fromwhere) lseek(__handle, __offset, __fromwhere)
  243. #define _dup(__h) dup(__h)
  244.  
  245. #ifdef __cplusplus
  246. }
  247. #endif
  248.  
  249.  
  250. #if !defined(RC_INVOKED)
  251.  
  252. /* Obsolete functions */
  253. #pragma obsolete _chmod
  254.  
  255. /* restore default packing */
  256. #pragma pack(pop)
  257.  
  258. #if defined(__STDC__)
  259. #pragma warn .nak
  260. #endif
  261.  
  262. #endif  /* !RC_INVOKED */
  263.  
  264. #ifdef __cplusplus
  265. } // std
  266. #endif
  267.  
  268. #endif  /* __IO_H */
  269.  
  270. #if defined(__cplusplus) && !defined(__USING_CNAME__) && !defined(__IO_H_USING_LIST)
  271. #define __IO_H_USING_LIST
  272.     using std::_nfile;
  273.     using std::access;
  274.     using std::_rtl_chmod;
  275.     using std::_chmod;
  276.     using std::_rtl_chmod;
  277.     using std::_chmod;
  278.     using std::chmod;
  279.     using std::chsize;
  280.     using std::_rtl_close;
  281.     using std::_close;
  282.     using std::close;
  283.     using std::_rtl_creat;
  284.     using std::_creat;
  285.     using std::creat;
  286.     using std::creatnew;
  287.     using std::creattemp;
  288.     using std::dup;
  289.     using std::dup2;
  290.     using std::eof;
  291.     using std::filelength;
  292.     using std::getftime;
  293.     using std::_waccess;
  294.     using std::_wchmod;
  295.     using std::_wrtl_chmod;
  296.     using std::_wcreat;
  297.     using std::_wrtl_creat;
  298.     using std::_wunlink;
  299.     using std::_wremove;
  300.     using std::_wrename;
  301.     using std::_wrtl_open;
  302.     using std::_wmktemp;
  303.     using std::_get_osfhandle;
  304.     using std::_open_osfhandle;
  305.     using std::ioctl;
  306.     using std::isatty;
  307.     using std::lock;
  308.     using std::locking;
  309.     using std::lseek;
  310.     using std::_mktemp;
  311.     using std::open;
  312.     using std::_wopen;
  313.     using std::open;
  314.     using std::_wopen;
  315.     using std::_rtl_open;
  316.     using std::_open;
  317.     using std::read;
  318.     using std::_rtl_read;
  319.     using std::_read;
  320.     using std::setftime;
  321.     using std::setmode;
  322.     using std::_sopen;
  323.     using std::_wsopen;
  324.     using std::tell;
  325.     using std::umask;
  326.     using std::unlink;
  327.     using std::unlock;
  328.     using std::_commit;
  329.     using std::_rtl_write;
  330.     using std::_write;
  331.     using std::write;
  332. #if !defined(__STDC__)
  333.     using std::mktemp;
  334.     using std::sopen;
  335. #endif
  336. #if defined (_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS >= 64) && !defined(__STDC__)
  337.     using std::_wfindfirsti64;
  338.     using std::_wfindnexti64;
  339.     using std::_findfirsti64;
  340.     using std::_findnexti64;
  341.     using std::_wfinddatai64_t;
  342.     using std::_finddatai64_t;
  343. #endif /* _INTEGRAL_MAX_BITS */
  344.     using std::__wfindfirst;
  345.     using std::__wfindnext;
  346.     using std::_findfirst;
  347.     using std::_findnext;
  348.     using std::_findclose;
  349.     using std::ftime;
  350.     using std::_wfinddata_t;
  351.     using std::_finddata_t;
  352. #endif /* __USING_CNAME__ */
  353.