home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / GFOPEN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  775 b   |  27 lines

  1. /*  gfopen - generalized buffered file open function  */
  2. /*            allows either Binary or ASCII treatment */
  3. /*  origional file edited for Lattice C / Microsoft C */
  4. #include   "stdio.h"
  5. #include   "cminor.h"
  6. FILE   *fopen() ;
  7.  
  8. extern  int   _fmode ;                  /* global binary/ASCII flag */
  9. FILE  *gfopen(fn,fmode,ft)
  10.   char  fn[] ;
  11.   char  fmode[] ;
  12.   int   ft ;
  13.   {
  14.      int   tmode ;
  15.      FILE  *tfd  ;
  16.  
  17.      tmode = _fmode ;                   /* save flag value */
  18.      if( ft == BIN_MODE )
  19.         _fmode = 0x800 ;                /* open in binary mode */
  20.      else  _fmode = 0 ;                 /* open in ASCII mode  */
  21.      tfd = fopen(fn,fmode) ;            /* open the file */
  22.      return( tfd ) ;
  23.   }
  24.  
  25. /* end of version */
  26.  
  27.