home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / IO / TELL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  408 b   |  23 lines

  1. /* tell.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <io.h>
  5. #include <errno.h>
  6.  
  7. long tell (int handle)
  8. {
  9.   long n;
  10.  
  11.   if (handle < 0 || handle >= _nfiles)
  12.     {
  13.       errno = EBADF;
  14.       return (-1L);
  15.     }
  16.   n = (long)__lseek (handle, 0L, SEEK_CUR);
  17.   if (n == -1)
  18.     return (n);
  19.   if (_lookahead[handle] >= 0)
  20.     --n;
  21.   return (n);
  22. }
  23.