home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / plstsrc / tcstuff / stdio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-18  |  4.2 KB  |  145 lines

  1. /*      STDIO.H
  2.  
  3.         Standard I/O Definition Includes
  4.  
  5.         Copyright (c) Borland International 1988
  6.         All Rights Reserved.
  7. */
  8.  
  9.  
  10. #if !defined( __STDIO )
  11. #define __STDIO
  12.  
  13.  
  14. #include <stdarg.h>
  15.  
  16.  
  17. typedef unsigned long   size_t;
  18. typedef unsigned long   fpos_t;
  19.  
  20.  
  21. /****** FileIo macros ***************************************************/
  22.  
  23. #define getc( c )     fgetc( c )
  24. #define getchar()     fgetc( &_StdInF )
  25. #define putc( c, s )  fputc( c, s )
  26. #define putchar( c )  fputc( c, &_StdOutF )
  27.  
  28.  
  29. /****** FileIo constants ************************************************/
  30.  
  31. #define NULL        ( ( void * ) 0L )
  32.  
  33. #ifndef NIL
  34. #  define NIL ((char *)"")
  35. #endif
  36.  
  37. /*#define FILE        int    */            /* hide actual structure */
  38. #define OPEN_MAX    32
  39. #define PATH_MAX    64
  40. #define BUFSIZ      1024
  41. #define EOF         (-1)
  42.  
  43. #define O_BINARY 0  /* extension GLASI        */
  44.  
  45. #define O_RDONLY    0x00
  46. #define O_WRONLY    0x01
  47. #define O_RDWR      0x02
  48. #define O_APPEND    0x04
  49. #define O_CREAT     0x20
  50. #define O_TRUNC     0x40
  51. #define O_EXCL      0x80
  52.  
  53. #define SEEK_SET    0
  54. #define SEEK_CUR    1
  55. #define SEEK_END    2
  56.  
  57. #define _IOFBF      0
  58. #define _IOLBF      1
  59. #define _IONBF      2
  60.  
  61. #define stdout      &_StdOutF
  62. #define stdin       &_StdInF
  63. #define stderr      &_StdErrF
  64.  
  65.  
  66. /****** External data **************************************************/
  67.  
  68. typedef struct  {
  69.    char *_ptr,*_buf1,*_buf2,*_bufend;
  70.    int handle;
  71.    char flags;
  72. }FILE;
  73.  
  74. extern FILE _filtab[OPEN_MAX];  /* extension GLASI      */
  75.  
  76.  
  77. extern FILE         _StdOutF;
  78. extern FILE         _StdInF;
  79. extern FILE         _StdErrF;
  80.  
  81. extern int          errno;
  82.  
  83. /****** FileIo routines *************************************************/
  84.  
  85. void    clearerr( FILE *stream );
  86. int     fclose( FILE *stream );
  87. int     feof( FILE *stream );
  88. int     ferror( FILE *stream );
  89. int     fflush( FILE *stream );
  90. int     fgetc( FILE *stream );
  91. int     fgetpos( FILE *stream, fpos_t *pos );
  92. char    *fgets( char *str, int n, FILE *stream );
  93. FILE    *fopen( const char *filename, const char *mode );
  94. int     fprintf( FILE *stream, const char *format, ... );
  95. int     fputc( int ch, FILE *stream );
  96. int     fputs( const char *str, FILE *stream );
  97. size_t  fread( void *buf, size_t elem_Siz, size_t count, FILE *stream );
  98. FILE    *freopen( const char *filename, const char *mode, FILE *stream );
  99. int     fscanf( FILE *stream, const char *format, ... );
  100. int     fseek( FILE *stream, long offset, int mode );
  101. void    rewind( FILE *stream);
  102. int     fsetpos( FILE *stream, const fpos_t *pos );
  103. long    ftell( FILE *stream );
  104. size_t  fwrite( const void *buf, size_t elem_Siz, size_t count,
  105.           FILE *stream );
  106. char    *gets( char *str );
  107. void    perror( char *s );
  108. int     printf( const char *format, ... );
  109. int     puts( const char *str );
  110. int     scanf( const char *format, ... );
  111. void    setbuf( FILE *stream, char *buf );
  112. int     setvbuf( FILE *stream, char *buf, int type, size_t size );
  113. int     sprintf( char *string, const char *format, ... );
  114. int     sscanf( char *string, const char *format, ... );
  115. char    *tmpnam( char *s );
  116. FILE    *tmpfile( void );
  117. int     ungetc( int ch, FILE *stream );
  118. int     vfprintf( FILE *stream, const char *format, va_list param );
  119. int     vprintf( const char *format, va_list param );
  120. int     vsprintf( char *string, const char *format, va_list param );
  121. int     vfscanf( FILE *stream, const char *format, va_list param );
  122. int     vscanf( const char *format, va_list param );
  123. int     vsscanf( char *string, const char *format, va_list param );
  124.  
  125. /* implemented by glasi                      */
  126. int fileno (FILE *fp);
  127.  
  128.  
  129. /****** Handle level FileIo routines ***********************************/
  130.  
  131. int     open( const char *, int, ... );
  132. int     close( int  );
  133. int     creat( const char *filename, ... );
  134. long    read( int handle, void *buf, size_t nbyte );
  135. long    write( int handle, void *buf, size_t nbyte );
  136. long    lseek( int handle, long position, int mode );
  137. int     remove( const char *filename );
  138. int     unlink( const char *filename );
  139. int     rename( const char *oldname, const char *newname );
  140.  
  141.  
  142. #endif
  143.  
  144. /***********************************************************************/
  145.