tell()                   Get Current File Pointer Position
 
 #include   <io.h>                       Required for declarations only
 
 long       tell(handle);
 int        handle;                      Handle referring to open file
 
    tell() gets the current position of the file pointer associated with
    'handle'.  The position is returned as the number of bytes from the
    beginning of the file.
 
    Returns:    The current file pointer position; or -1L if an error
                occurs. On error, 'errno' is set to:
 
                    EBADF   invalid file handle
 
      Notes:    tell() does not reposition the pointer.
 
  -------------------------------- Example ---------------------------------
 
    The following statements open a file, get the current position, move
    to a different position, then restore the pointer to the saved
    position.
 
          #include <io.h>
          #include <stdio.h>
          #include <fcntl.h>
 
          int fhndl;
          long position;
 
          main()
          {
                fhndl = open("c:\comp\invoice.dat",O_RDWR);
                .
                .
                position = tell(fhndl);
                lseek(fhndl,0L,SEEK_SET);
                .
                .
                lseek(fhndl,position,0);
          }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster