home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 163_01 / fseek2.c < prev    next >
Text File  |  1988-01-31  |  640b  |  18 lines

  1. /*
  2. ** reposition a stream file
  3. */
  4. #define FILE int
  5. #include <streamio.h>
  6. extern int fflush(), _seek(), free();
  7.  
  8. fseek2(stream, offset, ptrname) FILE *stream; int offset, ptrname; {
  9.   fflush(stream);  /* flush any write data */
  10.   if(stream[_IOB_CNT]) {  /* free read buffer if present */
  11.     free(stream[_IOB_BASE]);
  12.     stream[_IOB_CNT] = 0;
  13.     }
  14.   stream[_IOB_FLAG] &= ~(_UNGET);
  15.   _seek(stream[_IOB_FD], offset, ptrname);
  16.   return 0;
  17.   }
  18.