home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GERLIB_USR08B.LHA / gerlib / support / include / stdioprivate.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-12  |  489 b   |  18 lines

  1. #include <stdio.h>
  2. #include <ioprivate.h>
  3.  
  4. #define __validfp(fp) \
  5.   (((fp->_flags & _IO_MAGIC_MASK) == _OLD_STDIO_MAGIC && \
  6.     (fp = *(FILE**)&((int*)fp)[1])), \
  7.    __checkfp(fp))
  8. #define __checkfp(fp) (fp->_flags & _IO_MAGIC_MASK) == _IO_MAGIC
  9.  
  10. inline streambuf* FILE_to_streambuf(FILE* fp)
  11. {
  12.     if ((fp->_flags & _IO_MAGIC_MASK) == _OLD_STDIO_MAGIC)
  13.     return *(streambuf**)&((int*)fp)[1];
  14.     if ((fp->_flags & _IO_MAGIC_MASK) == _IO_MAGIC)
  15.     return (streambuf*)fp;
  16.     return NULL;
  17. }
  18.