home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / lib / dlibssrc / fseek.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-03  |  705 b   |  30 lines

  1. #include <osbind.h>
  2. #include <stdio.h>
  3. #include <io.h>
  4.  
  5. long fseek(fp, offset, origin)
  6. FILE *fp;
  7. long offset;
  8. int origin;
  9. /*
  10.  *    Operates like lseek(), except it works on streams.  Note that
  11.  *    stream file positions may be misleading due to translation of
  12.  *    <nl> characters during i/o.  ftell() may be used reliably with
  13.  *    fseek() to reposition a file to a prior location.
  14.  */
  15. {
  16.     fflush(fp);
  17.     return(Fseek(offset, fileno(fp), origin));
  18. }
  19.  
  20. void rewind(fp)
  21. register FILE *fp;
  22. /*
  23.  *    Operates like fseek(f,0L,_LSKbeg), except it also clears the
  24.  *    end-of-file and error flags for <fp>.  There is no return value.
  25.  */
  26. {
  27.     fseek(fp, 0L, _LSKbeg);
  28.     fp->F_stat &= ~(F_EOF|F_ERROR);
  29. }
  30.