home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / ansi / stdio / rewind.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-26  |  367 b   |  17 lines

  1. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  2. #include <libc/stubs.h>
  3. #include <stdio.h>
  4. #include <unistd.h>
  5. #include <libc/file.h>
  6.  
  7. void rewind(FILE *f)
  8. {
  9.   fflush(f);
  10.   lseek(fileno(f), 0L, SEEK_SET);
  11.   f->_cnt = 0;
  12.   f->_ptr = f->_base;
  13.   f->_flag &= ~(_IOERR|_IOEOF);
  14.   if (f->_flag & _IORW)
  15.     f->_flag &= ~(_IOREAD|_IOWRT);
  16. }
  17.