home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / STDIO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-20  |  19.2 KB  |  487 lines

  1. /*  stdio.h
  2.  
  3.     Definitions for stream input/output.
  4.  
  5. */
  6.  
  7. /* $Copyright: 1987$ */
  8. /* $Revision:   8.5  $ */
  9.  
  10. #ifndef __STDIO_H
  11. #define __STDIO_H
  12.  
  13. #if !defined(___DEFS_H)
  14. #include <_defs.h>
  15. #endif
  16.  
  17. #if !defined(___NFILE_H)
  18. #include <_nfile.h>
  19. #endif
  20.  
  21. #ifndef NULL
  22. #include <_null.h>
  23. #endif
  24.  
  25.  
  26. #if !defined(RC_INVOKED)
  27.  
  28. #if defined(__STDC__)
  29. #pragma warn -nak
  30. #endif
  31.  
  32. #pragma pack(push, 1)
  33.  
  34. #endif  /* !RC_INVOKED */
  35.  
  36.  
  37. #ifndef _SIZE_T
  38. #define _SIZE_T
  39. typedef unsigned size_t;
  40. #endif
  41.  
  42. #if !defined(_WINT_T)
  43. typedef unsigned short wint_t;
  44. #define _WINT_T
  45. #endif
  46.  
  47. #ifndef __cplusplus
  48. #if !defined(_WCHAR_T) && !defined(_WCHAR_T_DEFINED)
  49. #define _WCHAR_T
  50. #define _WCHAR_T_DEFINED  /* For WINDOWS.H */
  51. typedef unsigned short wchar_t;
  52. #endif
  53. #endif
  54.  
  55. /* Definition of the file position type
  56. */
  57. typedef long    fpos_t;
  58.  
  59. /* An external reference to _floatconvert (using #pragma extref _floatconvert)
  60.  * forces floating point format conversions to be linked.
  61.  */
  62. extern int _floatconvert;
  63.  
  64. /* Bufferisation type to be used as 3rd argument for "setvbuf" function
  65. */
  66. #define _IOFBF  0
  67. #define _IOLBF  1
  68. #define _IONBF  2
  69.  
  70. /*  "flags" bits definitions
  71. */
  72. #define _F_RDWR 0x0003                  /* Read/write flag       */
  73. #define _F_READ 0x0001                  /* Read only file        */
  74. #define _F_WRIT 0x0002                  /* Write only file       */
  75. #define _F_BUF  0x0004                  /* Malloc'ed Buffer data */
  76. #define _F_LBUF 0x0008                  /* line-buffered file    */
  77. #define _F_ERR  0x0010                  /* Error indicator       */
  78. #define _F_EOF  0x0020                  /* EOF indicator         */
  79. #define _F_BIN  0x0040                  /* Binary file indicator */
  80. #define _F_IN   0x0080                  /* Data is incoming      */
  81. #define _F_OUT  0x0100                  /* Data is outgoing      */
  82. #define _F_TERM 0x0200                  /* File is a terminal    */
  83.  
  84. /* End-of-file constant definition
  85. */
  86. #define EOF (-1)            /* End of file indicator */
  87. #define WEOF 0xFFFF         /* wide-character end of file indicator */
  88.  
  89. /* Default buffer size use by "setbuf" function
  90. */
  91. #define BUFSIZ  512         /* Buffer size for stdio */
  92.  
  93. /* Size of an arry large enough to hold a temporary file name string
  94. */
  95. #define L_ctermid   5       /* CON: plus null byte */
  96. #define P_tmpdir    ""      /* temporary directory */
  97. #define L_tmpnam    13      /* tmpnam buffer size */
  98.  
  99. /* Constants to be used as 3rd argument for "fseek" function
  100. */
  101. #define SEEK_CUR    1
  102. #define SEEK_END    2
  103. #define SEEK_SET    0
  104.  
  105. /* Number of unique file names that shall be generated by "tmpnam" function
  106. */
  107. #define TMP_MAX     0xFFFF
  108.  
  109.  
  110. #if !defined(__FLAT__)
  111.  
  112. /* Definition of the control structure for streams
  113. */
  114. typedef struct  {
  115.         int             level;          /* fill/empty level of buffer */
  116.         unsigned        flags;          /* File status flags          */
  117.         char            fd;             /* File descriptor            */
  118.         unsigned char   hold;           /* Ungetc char if no buffer   */
  119.         int             bsize;          /* Buffer size                */
  120.         unsigned char   _FAR *buffer;   /* Data transfer buffer       */
  121.         unsigned char   _FAR *curp;     /* Current active pointer     */
  122.         unsigned        istemp;         /* Temporary file indicator   */
  123.         short           token;          /* Used for validity checking */
  124. }       FILE;                           /* This is the FILE object    */
  125.  
  126. /* Number of files that can be open simultaneously
  127. */
  128. #if defined(__STDC__)
  129. #define FOPEN_MAX (_NFILE_ - 2) /* (_NFILE_ - stdaux & stdprn) */
  130. #else
  131. #define FOPEN_MAX (_NFILE_)     /* Able to have 20 files */
  132. #define SYS_OPEN  (_NFILE_)
  133. #endif
  134.  
  135. #define FILENAME_MAX 80
  136.  
  137. /* Standard I/O predefined streams
  138. */
  139.  
  140. #if !defined( _RTLDLL )
  141. extern  FILE    _RTLENTRY _streams[];
  142. extern  unsigned    _RTLENTRY _nfile;
  143.  
  144. #define stdin   (&_streams[0])
  145. #define stdout  (&_streams[1])
  146. #define stderr  (&_streams[2])
  147. #define stdaux  (&_streams[3])
  148. #define stdprn  (&_streams[4])
  149.  
  150. #else
  151.  
  152. #ifdef __cplusplus
  153. extern "C" {
  154. #endif
  155. FILE far * far _RTLENTRY __getStream(int);
  156. #ifdef __cplusplus
  157. }
  158. #endif
  159.  
  160. #define stdin   __getStream(0)
  161. #define stdout  __getStream(1)
  162. #define stderr  __getStream(2)
  163.  
  164. #endif  /* _RTLDLL  */
  165.  
  166. #ifdef __cplusplus
  167. extern "C" {
  168. #endif
  169. void    _RTLENTRY          clearerr(FILE _FAR *__stream);
  170. int     _RTLENTRY _EXPFUNC fclose(FILE _FAR *__stream);
  171. int     _RTLENTRY _EXPFUNC fflush(FILE _FAR *__stream);
  172. int     _RTLENTRY _EXPFUNC fgetc(FILE _FAR *__stream);
  173. int     _RTLENTRY          fgetpos(FILE _FAR *__stream, fpos_t _FAR *__pos);
  174. char   _FAR *_RTLENTRY _EXPFUNC fgets(char _FAR *__s, int __n, FILE _FAR *__stream);
  175. FILE   _FAR *_RTLENTRY _EXPFUNC fopen(const char _FAR *__path, const char _FAR *__mode);
  176. int     _RTLENTRY _EXPFUNC fprintf(FILE _FAR *__stream, const char _FAR *__format, ...);
  177. int     _RTLENTRY _EXPFUNC fputc(int __c, FILE _FAR *__stream);
  178. int     _RTLENTRY _EXPFUNC fputs(const char _FAR *__s, FILE _FAR *__stream);
  179. size_t  _RTLENTRY _EXPFUNC fread(void _FAR *__ptr, size_t __size, size_t __n,
  180.                      FILE _FAR *__stream);
  181. FILE   _FAR *_RTLENTRY _EXPFUNC freopen(const char _FAR *__path, const char _FAR *__mode,
  182.                             FILE _FAR *__stream);
  183. int     _RTLENTRY _EXPFUNC fscanf(FILE _FAR *__stream, const char _FAR *__format, ...);
  184. int     _RTLENTRY _EXPFUNC fseek(FILE _FAR *__stream, long __offset, int __whence);
  185. int     _RTLENTRY          fsetpos(FILE _FAR *__stream, const fpos_t _FAR *__pos);
  186. long    _RTLENTRY _EXPFUNC ftell(FILE _FAR *__stream);
  187. size_t  _RTLENTRY _EXPFUNC fwrite(const void _FAR *__ptr, size_t __size, size_t __n,
  188.                       FILE _FAR *__stream);
  189. char   _FAR *_RTLENTRY     gets(char _FAR *__s);
  190. void    _RTLENTRY          perror(const char _FAR *__s);
  191. int     _RTLENTRY          printf(const char _FAR *__format, ...);
  192. int     _RTLENTRY          puts(const char _FAR *__s);
  193. int     _RTLENTRYF         remove(const char _FAR *__path);
  194. int     _RTLENTRYF _EXPFUNC rename(const char _FAR *__oldname,const char _FAR *__newname);
  195. void    _RTLENTRY _EXPFUNC rewind(FILE _FAR *__stream);
  196. int     _RTLENTRY          scanf(const char _FAR *__format, ...);
  197. void    _RTLENTRY          setbuf(FILE _FAR *__stream, char _FAR *__buf);
  198. int     _RTLENTRY _EXPFUNC setvbuf(FILE _FAR *__stream, char _FAR *__buf,
  199.                                    int __type, size_t __size);
  200. int     _RTLENTRY _EXPFUNC sprintf(char _FAR *__buffer, const char _FAR *__format, ...);
  201. int     _RTLENTRY _EXPFUNC sscanf(const char _FAR *__buffer,
  202.                                   const char _FAR *__format, ...);
  203. char   _FAR *_RTLENTRY _EXPFUNC strerror(int __errnum);
  204. FILE   _FAR *_RTLENTRY _EXPFUNC tmpfile(void);
  205. char   _FAR *_RTLENTRY _EXPFUNC tmpnam(char _FAR *__s);
  206. int     _RTLENTRY _EXPFUNC ungetc(int __c, FILE _FAR *__stream);
  207. int     _RTLENTRY _EXPFUNC vfprintf(FILE _FAR *__stream, const char _FAR *__format,
  208.                                     void _FAR *__arglist);
  209. int     _RTLENTRY _EXPFUNC vfscanf(FILE _FAR *__stream, const char _FAR *__format,
  210.                                    void _FAR *__arglist);
  211. int     _RTLENTRYF         vprintf(const char _FAR *__format, void _FAR *__arglist);
  212. int     _RTLENTRY          vscanf(const char _FAR *__format, void _FAR *__arglist);
  213. int     _RTLENTRY _EXPFUNC vsprintf(char _FAR *__buffer, const char _FAR *__format,
  214.                                     void _FAR *__arglist);
  215. int     _RTLENTRY _EXPFUNC vsscanf(const char _FAR *__buffer, const char _FAR *__format,
  216.                                    void _FAR *__arglist);
  217. int     _RTLENTRYF         unlink(const char _FAR *__path);
  218. int     _RTLENTRY          getc(FILE _FAR *__fp);
  219.  
  220. int     _RTLENTRY          getchar(void);
  221. int     _RTLENTRY          putchar(const int __c);
  222.  
  223. int     _RTLENTRY          putc(const int __c, FILE _FAR *__fp);
  224. int     _RTLENTRY          feof(FILE _FAR *__fp);
  225. int     _RTLENTRY          ferror(FILE _FAR *__fp);
  226. int     _RTLENTRY          fileno(FILE _FAR *__fp);
  227.  
  228. int     _RTLENTRY _EXPFUNC fcloseall(void);
  229. FILE    _FAR *_RTLENTRY _EXPFUNC fdopen(int __handle, char _FAR *__type);
  230. int     _RTLENTRY _EXPFUNC fgetchar(void);
  231. int     _RTLENTRY _EXPFUNC flushall(void);
  232. int     _RTLENTRY _EXPFUNC fputchar(int __c);
  233. FILE    _FAR * _RTLENTRY   _fsopen (const char _FAR *__path, const char _FAR *__mode,
  234.                   int __shflag);
  235. int     _RTLENTRY          getw(FILE _FAR *__stream);
  236. int     _RTLENTRY          putw(int __w, FILE _FAR *__stream);
  237. int     _RTLENTRY          rmtmp(void);
  238. char    _FAR * _RTLENTRY _EXPFUNC _strerror(const char _FAR *__s);
  239. char    _FAR * _RTLENTRY _EXPFUNC tempnam(char _FAR *__dir, char _FAR *__pfx);
  240.  
  241. int      _RTLENTRY _EXPFUNC _fgetc(FILE _FAR *__stream);           /* used by getc() macro */
  242. int      _RTLENTRY _EXPFUNC _fputc(char __c, FILE _FAR *__stream); /* used by putc() macro */
  243. void     _RTLENTRY _InitEasyWin(void);  /* Initialization call for Easy Windows */
  244.  
  245. #ifdef  __cplusplus
  246. }
  247. #endif   /* __cplusplus */
  248.  
  249. #else    /* defined __FLAT__ */
  250.  
  251. /* Definition of the control structure for streams
  252. */
  253. typedef struct  {
  254.         unsigned char  *curp;       /* Current active pointer     */
  255.         unsigned char  *buffer;     /* Data transfer buffer       */
  256.         int             level;      /* fill/empty level of buffer */
  257.         int             bsize;      /* Buffer size                */
  258.         unsigned short  istemp;     /* Temporary file indicator   */
  259.         unsigned short  flags;      /* File status flags          */
  260.         wchar_t         hold;       /* Ungetc char if no buffer   */
  261.         char            fd;         /* File descriptor            */
  262.         unsigned char   token;      /* Used for validity checking */
  263. }       FILE;                       /* This is the FILE object    */
  264.  
  265. /* Number of files that can be open simultaneously
  266. */
  267. #if defined(__STDC__)
  268. #define FOPEN_MAX (_NFILE_)
  269. #else
  270. #define FOPEN_MAX (_NFILE_)
  271. #define SYS_OPEN  (_NFILE_)
  272. #endif
  273.  
  274. #define FILENAME_MAX 260
  275.  
  276. /* Standard I/O predefined streams
  277. */
  278. extern  FILE        _RTLENTRY _EXPDATA _streams[];
  279. extern  unsigned    _RTLENTRY _EXPDATA _nfile;
  280.  
  281. #define stdin   (&_streams[0])
  282. #define stdout  (&_streams[1])
  283. #define stderr  (&_streams[2])
  284.  
  285. #ifdef __cplusplus
  286. extern "C" {
  287. #endif
  288. /* __getStream() is used internally with CG only, but prototyped here for
  289.   consistancy with the 16-bit version.
  290. */
  291. FILE * _RTLENTRY _EXPFUNC __getStream( int );
  292. #ifdef __cplusplus
  293. }
  294. #endif
  295.  
  296.  
  297. #ifdef __cplusplus
  298. extern "C" {
  299. #endif
  300. void    _RTLENTRY _EXPFUNC clearerr(FILE * __stream);
  301. int     _RTLENTRY _EXPFUNC fclose(FILE * __stream);
  302. int     _RTLENTRY _EXPFUNC fflush(FILE * __stream);
  303. int     _RTLENTRY _EXPFUNC fgetc(FILE * __stream);
  304. wint_t  _RTLENTRY _EXPFUNC fgetwc(FILE * __stream);
  305. int     _RTLENTRY _EXPFUNC fgetpos(FILE * __stream, fpos_t*__pos);
  306. char  * _RTLENTRY _EXPFUNC fgets(char * __s, int __n, FILE * __stream);
  307. wchar_t* _RTLENTRY _EXPFUNC fgetws(wchar_t * __s, int __n, FILE * __stream);
  308. FILE  * _RTLENTRY _EXPFUNC fopen(const char * __path, const char * __mode);
  309. FILE  * _RTLENTRY _EXPFUNC _wfopen(const wchar_t * __path, const wchar_t * __mode);
  310. int     _RTLENTRY _EXPFUNC fprintf(FILE * __stream, const char * __format, ...);
  311. int     _RTLENTRY _EXPFUNC fputc(int __c, FILE * __stream);
  312. wint_t  _RTLENTRY _EXPFUNC fputwc(wint_t __c, FILE * __stream);
  313. int     _RTLENTRY _EXPFUNC fputs(const char * __s, FILE * __stream);
  314. int     _RTLENTRY _EXPFUNC fputws(const wchar_t * __s, FILE * __stream);
  315. size_t  _RTLENTRY _EXPFUNC fread(void * __ptr, size_t __size, size_t __n,
  316.                                  FILE * __stream);
  317. FILE  * _RTLENTRY _EXPFUNC freopen(const char * __path, const char * __mode,
  318.                                    FILE * __stream);
  319. FILE  * _RTLENTRY _EXPFUNC _wfreopen(const wchar_t * __path, const wchar_t * __mode,
  320.                                    FILE * __stream);
  321. int     _RTLENTRY _EXPFUNC fscanf(FILE * __stream, const char * __format, ...);
  322. int     _RTLENTRY _EXPFUNC fseek(FILE * __stream, long __offset, int __whence);
  323. int     _RTLENTRY _EXPFUNC fsetpos(FILE * __stream, const fpos_t*__pos);
  324. long    _RTLENTRY _EXPFUNC ftell(FILE * __stream);
  325. size_t  _RTLENTRY _EXPFUNC fwrite(const void * __ptr, size_t __size, size_t __n,
  326.                             FILE * __stream);
  327. char  * _RTLENTRY _EXPFUNC gets(char * __s);
  328. wchar_t* _RTLENTRY _EXPFUNC _getws(wchar_t * __s);
  329.  
  330. #if defined(__OS2__) || defined(__WIN32__)
  331. int     _RTLENTRY _EXPFUNC _pclose(FILE *__stream);
  332. #endif
  333.  
  334. void    _RTLENTRY _EXPFUNC perror(const char * __s);
  335. void    _RTLENTRY _EXPFUNC _wperror(const wchar_t * __s);
  336.  
  337. #if defined(__OS2__) || defined(__WIN32__)
  338. FILE *  _RTLENTRY _EXPFUNC _popen(const char * __command, const char * __mode);
  339. #endif
  340. #if defined(__WIN32__)
  341. FILE *  _RTLENTRY _EXPFUNC _wpopen(const wchar_t * __command,
  342.                                    const wchar_t * __mode);
  343. #endif
  344.  
  345. int     _RTLENTRY _EXPFUNC printf(const char * __format, ...);
  346. int     _RTLENTRY _EXPFUNC wprintf(const wchar_t * __format, ...);
  347. int     _RTLENTRY _EXPFUNC puts(const char * __s);
  348. int     _RTLENTRY _EXPFUNC _putws(const wchar_t * __s);
  349.  
  350. int     _RTLENTRYF _EXPFUNC remove(const char * __path);
  351. int     _RTLENTRYF _EXPFUNC _wremove(const wchar_t * __path);
  352. int     _RTLENTRYF _EXPFUNC rename(const char * __oldname,const char * __newname);
  353. int     _RTLENTRYF _EXPFUNC _wrename(const wchar_t * __oldname,const wchar_t * __newname);
  354. void    _RTLENTRY  _EXPFUNC rewind(FILE * __stream);
  355. int     _RTLENTRY  _EXPFUNC scanf(const char * __format, ...);
  356. void    _RTLENTRY  _EXPFUNC setbuf(FILE * __stream, char * __buf);
  357. int     _RTLENTRY  _EXPFUNC setvbuf(FILE * __stream, char * __buf,
  358.                                     int __type, size_t __size);
  359. int     _RTLENTRY  _EXPFUNC sprintf(char * __buffer, const char * __format, ...);
  360. int     _RTLENTRY  _EXPFUNC swprintf(wchar_t * __buffer, const wchar_t * __format, ...);
  361.  
  362. int     _RTLENTRY  _EXPFUNC sscanf(const char * __buffer,
  363.                                    const char * __format, ...);
  364. int     _RTLENTRY  _EXPFUNC swscanf(const wchar_t * __buffer,
  365.                                    const wchar_t * __format, ...);
  366. char  * _RTLENTRY _EXPFUNC strerror(int __errnum);
  367. FILE  * _RTLENTRY _EXPFUNC tmpfile(void);
  368. char  * _RTLENTRY _EXPFUNC tmpnam(char * __s);
  369. wchar_t * _RTLENTRY _EXPFUNC _wtmpnam(wchar_t * __s);
  370. int     _RTLENTRY _EXPFUNC ungetc(int __c, FILE * __stream);
  371. wint_t  _RTLENTRY _EXPFUNC ungetwc(wint_t __c, FILE * __stream);
  372. int     _RTLENTRY _EXPFUNC vfprintf(FILE * __stream, const char * __format,
  373.                             void * __arglist);
  374. int     _RTLENTRY _EXPFUNC vfscanf(FILE * __stream, const char * __format,
  375.                             void * __arglist);
  376. int     _RTLENTRYF _EXPFUNC vprintf(const char * __format, void * __arglist);
  377. int     _RTLENTRY _EXPFUNC vscanf(const char * __format, void * __arglist);
  378. int     _RTLENTRY _EXPFUNC vsprintf(char * __buffer, const char * __format,
  379.                         void * __arglist);
  380. int     _RTLENTRY _EXPFUNC vsscanf(const char * __buffer, const char * __format,
  381.                         void * __arglist);
  382. int     _RTLENTRY _EXPFUNC vfwprintf(FILE * __stream, const wchar_t * __format,
  383.                             void * __arglist);
  384. int     _RTLENTRY _EXPFUNC vfwscanf(FILE * __stream, const wchar_t * __format,
  385.                             void * __arglist);
  386. int     _RTLENTRYF _EXPFUNC vwprintf(const wchar_t * __format, void * __arglist);
  387. int     _RTLENTRY _EXPFUNC vwscanf(const wchar_t * __format, void * __arglist);
  388. int     _RTLENTRY _EXPFUNC vswprintf(wchar_t * __buffer, const wchar_t * __format,
  389.                         void * __arglist);
  390. int     _RTLENTRY _EXPFUNC vswscanf(const wchar_t * __buffer, const wchar_t * __format,
  391.                         void * __arglist);
  392. int     _RTLENTRYF _EXPFUNC unlink(const char * __path);
  393. int     _RTLENTRYF _EXPFUNC _wunlink(const wchar_t * __path);
  394.  
  395. int     _RTLENTRY _EXPFUNC getc(FILE * __fp);
  396. wint_t  _RTLENTRY _EXPFUNC getwc(FILE * __fp);
  397. int     _RTLENTRY _EXPFUNC getchar(void);
  398. wint_t  _RTLENTRY _EXPFUNC getwchar(void);
  399. int     _RTLENTRY _EXPFUNC putchar(const int __c);
  400. wint_t  _RTLENTRY _EXPFUNC putwchar(const wint_t __c);
  401. int     _RTLENTRY _EXPFUNC putc(const int __c, FILE * __fp);
  402. wint_t  _RTLENTRY _EXPFUNC putwc(const wint_t __c, FILE * __fp);
  403. int     _RTLENTRY _EXPFUNC feof(FILE * __fp);
  404. int     _RTLENTRY _EXPFUNC ferror(FILE * __fp);
  405. int     _RTLENTRY _EXPFUNC fileno(FILE _FAR *__fp);
  406.  
  407. int     _RTLENTRY _EXPFUNC fcloseall(void);
  408. FILE  * _RTLENTRY _EXPFUNC fdopen(int __handle, char * __type);
  409. FILE  * _RTLENTRY _EXPFUNC _wfdopen(int __handle, wchar_t * __type);
  410. int     _RTLENTRY _EXPFUNC fgetchar(void);
  411. wint_t  _RTLENTRY _EXPFUNC _fgetwchar(void);
  412. int     _RTLENTRY _EXPFUNC flushall(void);
  413. wint_t  _RTLENTRY _EXPFUNC _fputwchar(wint_t __c);
  414. int     _RTLENTRY _EXPFUNC fputchar(int __c);
  415. FILE  * _RTLENTRY _EXPFUNC _fsopen (const char * __path, const char * __mode,
  416.                               int __shflag);
  417. FILE  * _RTLENTRY _EXPFUNC _wfsopen (const wchar_t * __path,
  418.                               const wchar_t * __mode, int __shflag);
  419. int     _RTLENTRY _EXPFUNC getw(FILE * __stream);
  420. int     _RTLENTRY _EXPFUNC putw(int __w, FILE * __stream);
  421. int     _RTLENTRY _EXPFUNC rmtmp(void);
  422. char  * _RTLENTRY _EXPFUNC _strerror(const char * __s);
  423. char  * _RTLENTRY _EXPFUNC tempnam(char * __dir, char * __pfx);
  424. wchar_t * _RTLENTRY _EXPFUNC _wtempnam(wchar_t * __dir, wchar_t * __pfx);
  425.  
  426. int      _RTLENTRY _EXPFUNC _fgetc(FILE * __stream);           /* used by getc() macro */
  427. wint_t   _RTLENTRY _EXPFUNC _fgetwc(FILE * __stream);
  428. int      _RTLENTRY _EXPFUNC _fputc(char __c, FILE * __stream); /* used by putc() macro */
  429. wint_t   _RTLENTRY _EXPFUNC _fputwc(wchar_t __c, FILE * __stream);
  430. #ifdef  __cplusplus
  431. }
  432. #endif
  433.  
  434. #if defined(__MFC_COMPAT__)
  435. inline FILE _FAR *_RTLENTRY _fdopen(int __handle, char _FAR *__type)
  436.                             { return fdopen(__handle, __type); }
  437. inline int        _RTLENTRY _fileno(FILE _FAR *__fp) { return fileno(__fp); }
  438. inline int        _RTLENTRY _fgetchar(void) { return fgetchar(); }
  439. inline int        _RTLENTRY _fputchar(int __c) { return fputchar(__c); }
  440. #endif   /* __MFC_COMPAT__ */
  441.  
  442. #endif  /* __FLAT__ */
  443.  
  444. /*  The following macros provide for common functions */
  445.  
  446. #if !defined(__CODEGUARD__)
  447.  
  448. #define ferror(f)   ((f)->flags & _F_ERR)
  449. #define feof(f)     ((f)->flags & _F_EOF)
  450. #if !defined(__MFC_COMPAT__)
  451. #define fileno(f)   ((f)->fd)
  452. #endif
  453. #if defined(__MSC) && !defined(__MFC_COMPAT__)
  454. #define _fileno(f)  fileno(f)
  455. #endif
  456.  
  457. #define getc(f) \
  458.   ((--((f)->level) >= 0) ? (unsigned char)(*(f)->curp++) : \
  459.     _fgetc (f))
  460.  
  461. #define putc(c,f) \
  462.   ((++((f)->level) < 0) ? (unsigned char)(*(f)->curp++=(c)) : \
  463.     _fputc ((c),f))
  464.  
  465. #define getchar()   getc(stdin)
  466. #define getwchar()  getwc(stdin)
  467. #define putchar(c)  putc((c), stdout)
  468. #define putwchar(c) putwc((c), stdout)
  469.  
  470. #endif
  471.  
  472. #define ungetc(c,f) ungetc((c),f)   /* traditionally a macro */
  473.  
  474. #if !defined(RC_INVOKED)
  475.  
  476. /* restore default packing */
  477. #pragma pack(pop)
  478.  
  479. #if defined(__STDC__)
  480. #pragma warn .nak
  481. #endif
  482.  
  483. #endif  /* !RC_INVOKED */
  484.  
  485.  
  486. #endif  /* __STDIO_H */
  487.