home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c045 / 2.ddi / INCLUDE / STDIO.H$ / STDIO.bin
Encoding:
Text File  |  1992-01-01  |  8.6 KB  |  371 lines

  1. /***
  2. *stdio.h - definitions/declarations for standard I/O routines
  3. *
  4. *    Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *    This file defines the structures, values, macros, and functions
  8. *    used by the level 2 I/O ("standard I/O") routines.
  9. *    [ANSI/System V]
  10. *
  11. ****/
  12.  
  13. #ifndef _INC_STDIO
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18.  
  19. #if defined(_DLL) && !defined(_MT)
  20. #error Cannot define _DLL without _MT
  21. #endif
  22.  
  23. #ifdef _MT
  24. #define _FAR_ __far
  25. #else
  26. #define _FAR_
  27. #endif
  28.  
  29. #if (_MSC_VER <= 600)
  30. #define __cdecl     _cdecl
  31. #define __far       _far
  32. #define __loadds    _loadds
  33. #define __near      _near
  34. #endif
  35.  
  36. #ifndef _SIZE_T_DEFINED
  37. typedef unsigned int size_t;
  38. #define _SIZE_T_DEFINED
  39. #endif
  40.  
  41. #ifndef _VA_LIST_DEFINED
  42. typedef char _FAR_ *va_list;
  43. #define _VA_LIST_DEFINED
  44. #endif
  45.  
  46. /* buffered I/O macros */
  47.  
  48. #define BUFSIZ    512
  49. #ifdef _MT
  50. #define _NFILE    40
  51. #else
  52. #define _NFILE    20
  53. #endif
  54. #define EOF    (-1)
  55.  
  56. #ifndef _FILE_DEFINED
  57. #pragma pack(2)
  58. struct _iobuf {
  59.     char _FAR_ *_ptr;
  60.     int   _cnt;
  61.     char _FAR_ *_base;
  62.     char  _flag;
  63.     char  _file;
  64.     };
  65. typedef struct _iobuf FILE;
  66. #pragma pack()
  67. #define _FILE_DEFINED
  68. #endif
  69.  
  70.  
  71. /* _P_tmpnam: Directory where temporary files may be created.
  72.  * L_tmpnam size =  size of _P_tmpdir
  73.  *    + 1 (in case _P_tmpdir does not end in "\\")
  74.  *    + 6 (for the temp number string)
  75.  *    + 1 (for the null terminator)
  76.  */
  77.  
  78. #define  _P_tmpdir "\\"
  79. #define  L_tmpnam sizeof(_P_tmpdir)+8
  80.  
  81.  
  82. /* fseek constants */
  83.  
  84. #define SEEK_CUR 1
  85. #define SEEK_END 2
  86. #define SEEK_SET 0
  87.  
  88.  
  89. /* minimum guaranteed filename length, open file count, and unique
  90.  * tmpnam filenames.
  91.  */
  92.  
  93. #define FILENAME_MAX 63
  94. #define FOPEN_MAX 18
  95. #define TMP_MAX 32767
  96. #define _SYS_OPEN 20
  97.  
  98.  
  99. /* define NULL pointer value */
  100.  
  101. #ifndef NULL
  102. #ifdef __cplusplus
  103. #define NULL    0
  104. #else
  105. #define NULL    ((void *)0)
  106. #endif
  107. #endif
  108.  
  109.  
  110. /* declare _iob[] array */
  111.  
  112. #ifndef _STDIO_DEFINED
  113. #ifdef _DLL
  114. extern FILE _FAR_ __cdecl _iob[];
  115. #else
  116. extern FILE __near __cdecl _iob[];
  117. #endif
  118. #endif
  119.  
  120.  
  121. /* define file position type */
  122.  
  123. #ifndef _FPOS_T_DEFINED
  124. typedef long fpos_t;
  125. #define _FPOS_T_DEFINED
  126. #endif
  127.  
  128.  
  129. /* standard file pointers */
  130.  
  131. #ifndef _WINDLL
  132. #define stdin  (&_iob[0])
  133. #define stdout (&_iob[1])
  134. #define stderr (&_iob[2])
  135. #endif
  136. #ifndef _WINDOWS
  137. #define _stdaux (&_iob[3])
  138. #define _stdprn (&_iob[4])
  139. #endif
  140.  
  141.  
  142. #define _IOREAD     0x01
  143. #define _IOWRT        0x02
  144.  
  145. #define _IOFBF        0x0
  146. #define _IOLBF        0x40
  147. #define _IONBF        0x04
  148.  
  149. #define _IOMYBUF    0x08
  150. #define _IOEOF        0x10
  151. #define _IOERR        0x20
  152. #define _IOSTRG     0x40
  153. #define _IORW        0x80
  154.  
  155.  
  156. #ifdef _WINDOWS
  157. #ifndef _WINDLL
  158. #ifndef _WINFO_DEFINED
  159. /* interface version number */
  160. #define _WINVER     0
  161.  
  162. /* max number of windows */
  163. #define _WFILE        20
  164.  
  165. /* values for windows screen buffer size */
  166. #define _WINBUFINF    0
  167. #define _WINBUFDEF    -1
  168.  
  169. /* size/move settings */
  170. #define _WINSIZEMIN    1
  171. #define _WINSIZEMAX    2
  172. #define _WINSIZERESTORE 3
  173. #define _WINSIZECHAR    4
  174.  
  175. /* size/move query types */
  176. #define _WINMAXREQ    100
  177. #define _WINCURRREQ    101
  178.  
  179. /* values for closing window */
  180. #define _WINPERSIST    1
  181. #define _WINNOPERSIST    0
  182.  
  183. /* pseudo file handle for frame window */
  184. #define _WINFRAMEHAND    -1
  185.  
  186. /* menu items */
  187. #define _WINSTATBAR    1
  188. #define _WINTILE    2
  189. #define _WINCASCADE    3
  190. #define _WINARRANGE    4
  191.  
  192. /* quickwin exit options */
  193. #define _WINEXITPROMPT        1
  194. #define _WINEXITNOPERSIST    2
  195. #define _WINEXITPERSIST     3
  196.  
  197. /* open structure */
  198. #pragma pack(2)
  199. struct _wopeninfo {
  200.     unsigned int _version;
  201.     const char __far * _title;
  202.     long _wbufsize;
  203.     };
  204. #pragma pack()
  205.  
  206. /* size/move structure */
  207. struct _wsizeinfo {
  208.     unsigned int _version;
  209.     unsigned int _type;
  210.     unsigned int _x;
  211.     unsigned int _y;
  212.     unsigned int _h;
  213.     unsigned int _w;
  214.     };
  215. #define _WINFO_DEFINED
  216. #endif
  217. #endif
  218. #endif
  219.  
  220. /* function prototypes */
  221.  
  222. #ifndef _STDIO_DEFINED
  223. int _FAR_ __cdecl _filbuf(FILE _FAR_ *);
  224. int _FAR_ __cdecl _flsbuf(int, FILE _FAR_ *);
  225. FILE _FAR_ * _FAR_ __cdecl _fsopen(const char _FAR_ *,
  226.     const char _FAR_ *, int);
  227. void _FAR_ __cdecl clearerr(FILE _FAR_ *);
  228. int _FAR_ __cdecl fclose(FILE _FAR_ *);
  229. int _FAR_ __cdecl _fcloseall(void);
  230. FILE _FAR_ * _FAR_ __cdecl _fdopen(int, const char _FAR_ *);
  231. int _FAR_ __cdecl feof(FILE _FAR_ *);
  232. int _FAR_ __cdecl ferror(FILE _FAR_ *);
  233. int _FAR_ __cdecl fflush(FILE _FAR_ *);
  234. int _FAR_ __cdecl fgetc(FILE _FAR_ *);
  235. #ifndef _WINDLL
  236. int _FAR_ __cdecl _fgetchar(void);
  237. #endif
  238. int _FAR_ __cdecl fgetpos(FILE _FAR_ *, fpos_t _FAR_ *);
  239. char _FAR_ * _FAR_ __cdecl fgets(char _FAR_ *, int, FILE _FAR_ *);
  240. int _FAR_ __cdecl _fileno(FILE _FAR_ *);
  241. int _FAR_ __cdecl _flushall(void);
  242. FILE _FAR_ * _FAR_ __cdecl fopen(const char _FAR_ *,
  243.     const char _FAR_ *);
  244. #ifndef _WINDLL
  245. int _FAR_ __cdecl fprintf(FILE _FAR_ *, const char _FAR_ *, ...);
  246. #endif
  247. int _FAR_ __cdecl fputc(int, FILE _FAR_ *);
  248. #ifndef _WINDLL
  249. int _FAR_ __cdecl _fputchar(int);
  250. #endif
  251. int _FAR_ __cdecl fputs(const char _FAR_ *, FILE _FAR_ *);
  252. size_t _FAR_ __cdecl fread(void _FAR_ *, size_t, size_t, FILE _FAR_ *);
  253. FILE _FAR_ * _FAR_ __cdecl freopen(const char _FAR_ *,
  254.     const char _FAR_ *, FILE _FAR_ *);
  255. #ifndef _WINDLL
  256. int _FAR_ __cdecl fscanf(FILE _FAR_ *, const char _FAR_ *, ...);
  257. #endif
  258. int _FAR_ __cdecl fsetpos(FILE _FAR_ *, const fpos_t _FAR_ *);
  259. int _FAR_ __cdecl fseek(FILE _FAR_ *, long, int);
  260. long _FAR_ __cdecl ftell(FILE _FAR_ *);
  261. #ifdef _WINDOWS
  262. #ifndef _WINDLL
  263. FILE * _FAR_ __cdecl _fwopen(struct _wopeninfo _FAR_ *, struct _wsizeinfo _FAR_ *, const char _FAR_ *);
  264. #endif
  265. #endif
  266. size_t _FAR_ __cdecl fwrite(const void _FAR_ *, size_t, size_t,
  267.     FILE _FAR_ *);
  268. int _FAR_ __cdecl getc(FILE _FAR_ *);
  269. #ifndef _WINDLL
  270. int _FAR_ __cdecl getchar(void);
  271. char _FAR_ * _FAR_ __cdecl gets(char _FAR_ *);
  272. #endif
  273. int _FAR_ __cdecl _getw(FILE _FAR_ *);
  274. #ifndef _WINDLL
  275. void _FAR_ __cdecl perror(const char _FAR_ *);
  276. #endif
  277. int _FAR_ __cdecl _pclose(FILE _FAR_ *);
  278. FILE _FAR_ * _FAR_ __cdecl _popen(const char _FAR_ *,
  279.     const char _FAR_ *);
  280. #ifndef _WINDLL
  281. int _FAR_ __cdecl printf(const char _FAR_ *, ...);
  282. #endif
  283. int _FAR_ __cdecl putc(int, FILE _FAR_ *);
  284. #ifndef _WINDLL
  285. int _FAR_ __cdecl putchar(int);
  286. int _FAR_ __cdecl puts(const char _FAR_ *);
  287. #endif
  288. int _FAR_ __cdecl _putw(int, FILE _FAR_ *);
  289. int _FAR_ __cdecl remove(const char _FAR_ *);
  290. int _FAR_ __cdecl rename(const char _FAR_ *, const char _FAR_ *);
  291. void _FAR_ __cdecl rewind(FILE _FAR_ *);
  292. int _FAR_ __cdecl _rmtmp(void);
  293. #ifndef _WINDLL
  294. int _FAR_ __cdecl scanf(const char _FAR_ *, ...);
  295. #endif
  296. void _FAR_ __cdecl setbuf(FILE _FAR_ *, char _FAR_ *);
  297. int _FAR_ __cdecl setvbuf(FILE _FAR_ *, char _FAR_ *, int, size_t);
  298. #ifndef _WINDLL
  299. int _FAR_ __cdecl sprintf(char _FAR_ *, const char _FAR_ *, ...);
  300. int _FAR_ __cdecl sscanf(const char _FAR_ *, const char _FAR_ *, ...);
  301. #endif
  302. char _FAR_ * _FAR_ __cdecl _tempnam(char _FAR_ *, char _FAR_ *);
  303. FILE _FAR_ * _FAR_ __cdecl tmpfile(void);
  304. char _FAR_ * _FAR_ __cdecl tmpnam(char _FAR_ *);
  305. int _FAR_ __cdecl ungetc(int, FILE _FAR_ *);
  306. int _FAR_ __cdecl _unlink(const char _FAR_ *);
  307. #ifndef _WINDLL
  308. int _FAR_ __cdecl vfprintf(FILE _FAR_ *, const char _FAR_ *, va_list);
  309. int _FAR_ __cdecl vprintf(const char _FAR_ *, va_list);
  310. int _FAR_ __cdecl vsprintf(char _FAR_ *, const char _FAR_ *, va_list);
  311. #endif
  312. #define _STDIO_DEFINED
  313. #endif
  314.  
  315. /* macro definitions */
  316.  
  317. #define feof(_stream)      ((_stream)->_flag & _IOEOF)
  318. #define ferror(_stream)   ((_stream)->_flag & _IOERR)
  319. #define _fileno(_stream)  ((int)(unsigned char)(_stream)->_file)
  320. #define getc(_stream)      (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ \
  321.     : _filbuf(_stream))
  322. #define putc(_c,_stream)  (--(_stream)->_cnt >= 0 \
  323.     ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) :  _flsbuf((_c),(_stream)))
  324. #ifndef _WINDLL
  325. #define getchar()      getc(stdin)
  326. #define putchar(_c)      putc((_c),stdout)
  327. #endif
  328.  
  329. #ifdef _MT
  330. #undef    getc
  331. #undef    putc
  332. #undef    getchar
  333. #undef    putchar
  334. #endif
  335.  
  336. #ifndef __STDC__
  337. /* Non-ANSI names for compatibility */
  338.  
  339. #define P_tmpdir  _P_tmpdir
  340. #define SYS_OPEN  _SYS_OPEN
  341.  
  342. #ifndef _WINDOWS
  343. #define stdaux      _stdaux
  344. #define stdprn      _stdprn
  345. #endif
  346.  
  347. int _FAR_ __cdecl fcloseall(void);
  348. FILE _FAR_ * _FAR_ __cdecl fdopen(int, const char _FAR_ *);
  349. #ifndef _WINDLL
  350. int _FAR_ __cdecl fgetchar(void);
  351. #endif
  352. int _FAR_ __cdecl fileno(FILE _FAR_ *);
  353. int _FAR_ __cdecl flushall(void);
  354. #ifndef _WINDLL
  355. int _FAR_ __cdecl fputchar(int);
  356. #endif
  357. int _FAR_ __cdecl getw(FILE _FAR_ *);
  358. int _FAR_ __cdecl putw(int, FILE _FAR_ *);
  359. int _FAR_ __cdecl rmtmp(void);
  360. char _FAR_ * _FAR_ __cdecl tempnam(char _FAR_ *, char _FAR_ *);
  361. int _FAR_ __cdecl unlink(const char _FAR_ *);
  362.  
  363. #endif    /* __STDC__ */
  364.  
  365. #ifdef __cplusplus
  366. }
  367. #endif
  368.  
  369. #define _INC_STDIO
  370. #endif    /* _INC_STDIO */
  371.