home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / h.z / IO.H < prev    next >
C/C++ Source or Header  |  1996-09-19  |  6KB  |  192 lines

  1. /*
  2.  *  io.h        Low level I/O routines that work with file handles
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5.  */
  6. #ifndef _IO_H_INCLUDED
  7. #define _IO_H_INCLUDED
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. #ifndef _COMDEF_H_INCLUDED
  13.  #include <_comdef.h>
  14. #endif
  15.  
  16. #ifndef _TIME_T_DEFINED
  17. #define _TIME_T_DEFINED
  18. #define _TIME_T_DEFINED_
  19. typedef unsigned long time_t; /* time value */
  20. #endif
  21.  
  22. #ifndef _WCHAR_T_DEFINED
  23. #define _WCHAR_T_DEFINED
  24. #define _WCHAR_T_DEFINED_
  25. #ifdef __cplusplus
  26. typedef long char wchar_t;
  27. #else
  28. typedef unsigned short wchar_t;
  29. #endif
  30. #endif
  31.  
  32. #ifndef _MAX_PATH
  33.  #if defined(__OS2__) || defined(__NT__)
  34.   #define _MAX_PATH   260 /* maximum length of full pathname */
  35.  #else
  36.   #define _MAX_PATH   144 /* maximum length of full pathname */
  37.  #endif
  38. #endif
  39.  
  40. /* Symbolic constants for the access() function */
  41.  
  42. #define R_OK    4       /*  Test for read permission    */
  43. #define W_OK    2       /*  Test for write permission   */
  44. #define X_OK    1       /*  Test for execute permission */
  45. #define F_OK    0       /*  Test for existence of file  */
  46.  
  47. #define ACCESS_WR       0x0002
  48. #define ACCESS_RD       0x0004
  49.  
  50. /* Symbolic constants for the lseek() function */
  51.  
  52. #define SEEK_SET    0           /* Seek relative to the start of file   */
  53. #define SEEK_CUR    1           /* Seek relative to current position    */
  54. #define SEEK_END    2           /* Seek relative to the end of the file */
  55.  
  56. /* Symbolic constants for stream I/O */
  57.  
  58. #define STDIN_FILENO    0
  59. #define STDOUT_FILENO   1
  60. #define STDERR_FILENO   2
  61. #ifndef NO_EXT_KEYS     /* extensions enabled */
  62. #if ! defined(__NT__)
  63. #define STDAUX_FILENO   3
  64. #define STDPRN_FILENO   4
  65. #endif
  66. #endif
  67.  
  68.  
  69. typedef unsigned long    _fsize_t;
  70.  
  71. struct _finddata_t {
  72.     unsigned    attrib;
  73.     time_t    time_create;
  74.     time_t    time_access;
  75.     time_t    time_write;
  76.     _fsize_t    size;
  77.     char    name[_MAX_PATH];
  78. };
  79.  
  80. struct _wfinddata_t {
  81.     unsigned    attrib;
  82.     time_t    time_create;
  83.     time_t    time_access;
  84.     time_t    time_write;
  85.     _fsize_t    size;
  86.     wchar_t    name[_MAX_PATH];
  87. };
  88.  
  89. #ifdef __WATCOM_INT64__
  90. struct _finddatai64_t {
  91.     unsigned    attrib;
  92.     time_t    time_create;
  93.     time_t    time_access;
  94.     time_t    time_write;
  95.     __int64    size;
  96.     char    name[_MAX_PATH];
  97. };
  98.  
  99. struct _wfinddatai64_t {
  100.     unsigned    attrib;
  101.     time_t    time_create;
  102.     time_t    time_access;
  103.     time_t    time_write;
  104.     __int64    size;
  105.     wchar_t    name[_MAX_PATH];
  106. };
  107. #endif
  108.  
  109. /* File attribute constants for attrib field */
  110. #define _A_NORMAL       0x00    /* Normal file - read/write permitted */
  111. #define _A_RDONLY       0x01    /* Read-only file */
  112. #define _A_HIDDEN       0x02    /* Hidden file */
  113. #define _A_SYSTEM       0x04    /* System file */
  114. #define _A_SUBDIR       0x10    /* Subdirectory */
  115. #define _A_ARCH         0x20    /* Archive file */
  116.  
  117.  
  118. _WCRTLINK extern int  access(const char *__path,int __mode);
  119. _WCRTLINK extern int  _access(const char *__path,int __mode);
  120. _WCRTLINK extern int  chmod(const char *__path,int __pmode);
  121. _WCRTLINK extern int  chsize(int __handle,long __size);
  122. _WCRTLINK extern int  close(int __handle);
  123. _WCRTLINK extern int  _close(int __handle);
  124. _WCRTLINK extern int  creat(const char *__path,int __pmode);
  125. _WCRTLINK extern int  dup(int __handle);
  126. _WCRTLINK extern int  _dup(int __handle);
  127. _WCRTLINK extern int  dup2(int __handle1,int __handle2);
  128. _WCRTLINK extern int  eof(int __handle);
  129. _WCRTLINK extern long filelength(int __handle);
  130. _WCRTLINK extern int  fsync( int __filedes );
  131. _WCRTLINK extern long _get_osfhandle( int __posixhandle );
  132. _WCRTLINK extern int  _hdopen(int __handle,int __mode);
  133. _WCRTLINK extern int  isatty(int __handle);
  134. _WCRTLINK extern int  lock(int __handle,unsigned long __offset,
  135.                unsigned long __nbytes);
  136. _WCRTLINK extern long lseek(int __handle,long __offset,int __origin);
  137. _WCRTLINK extern long _lseek(int __handle,long __offset,int __origin);
  138. _WCRTLINK extern int  open(const char *__path,int __oflag,...);
  139. _WCRTLINK extern int  _open(const char *__path,int __oflag,...);
  140. _WCRTLINK extern int  _open_osfhandle( long __osfhandle, int __flags );
  141. _WCRTLINK extern int  _os_handle(int __handle);
  142. _WCRTLINK extern int  _pipe( int *__phandles, unsigned __psize, int __textmode );
  143. _WCRTLINK extern int  read(int __handle,void *__buf,unsigned int __len);
  144. _WCRTLINK extern int  setmode(int __handle,int __mode);
  145. _WCRTLINK extern int  sopen(const char *__path,int __oflag,int __shflag,...);
  146. _WCRTLINK extern long tell(int __handle);
  147. _WCRTLINK extern int  umask(int __permission);
  148. _WCRTLINK extern int  unlink(const char *__path);
  149. _WCRTLINK extern int  unlock(int __handle,unsigned long __offset,
  150.                  unsigned long __nbytes);
  151. _WCRTLINK extern int  write(int __handle,const void *__buf,unsigned int __len);
  152. _WCRTLINK extern int  _waccess(const wchar_t *__path,int __mode);
  153. _WCRTLINK extern int  _wchmod( const wchar_t *__path, int __pmode );
  154. _WCRTLINK extern int  _wunlink(const wchar_t *__path);
  155.  
  156. _WCRTLINK extern long _findfirst( char *__filespec,
  157.                   struct _finddata_t *__fileinfo );
  158. _WCRTLINK extern long _wfindfirst( wchar_t *__filespec,
  159.                    struct _wfinddata_t *__fileinfo );
  160. _WCRTLINK extern int  _findnext( long __handle,
  161.                  struct _finddata_t *__fileinfo );
  162. _WCRTLINK extern int  _wfindnext( long __handle,
  163.                   struct _wfinddata_t *__fileinfo );
  164. _WCRTLINK extern int  _findclose( long __handle );
  165.  
  166. _WCRTLINK extern char *        _mktemp( char *__template );
  167. _WCRTLINK extern wchar_t *  _wmktemp( wchar_t *__template );
  168.  
  169. #ifdef __WATCOM_INT64__
  170. _WCRTLINK extern long        _findfirsti64( char *__filespec,
  171.                        struct _finddatai64_t *__fileinfo );
  172. _WCRTLINK extern long        _wfindfirsti64( wchar_t *__filespec,
  173.                         struct _wfinddatai64_t *__fileinfo );
  174. _WCRTLINK extern int        _findnexti64( long __handle,
  175.                       struct _finddatai64_t *__fileinfo );
  176. _WCRTLINK extern int        _wfindnexti64( long __handle,
  177.                        struct _wfinddatai64_t *__fileinfo );
  178. _WCRTLINK extern __int64    _filelengthi64( int __handle );
  179. _WCRTLINK extern __int64    _lseeki64( int __handle, __int64 __offset,
  180.                        int __origin );
  181. _WCRTLINK extern __int64    _telli64( int __handle );
  182. #endif
  183.  
  184. #ifndef _STAT_H_INCLUDED
  185.  #include <sys/stat.h>
  186. #endif
  187.  
  188. #ifdef __cplusplus
  189. };
  190. #endif
  191. #endif
  192.