qc.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ftell
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The ftell function gets the current position of the file pointer
     (if any) associated with <stream>. The position is expressed as an
     offset relative to the beginning of the stream.
 
     Note that when a file is opened for appending data, the current
     file position is determined by the last I/O operation, not by the
     location of the next write.
 
     For example, if a file is opened for an append and the last
     operation was a read, the file position is the point where the
     next read operation would start, not where the next write would
     start. (When a file is opened for appending, the file position is
     moved to end-of-file before any write operation.) If no I/O
     operation has yet occurred on a file opened for appending, the
     file position is the beginning of the file.
 
     Return Value
 
     The ftell function returns the current file position. The value
     returned by ftell may not reflect the physical byte offset for
     streams opened in text mode, since text mode causes carriage-
     return──line-feed translation. Use ftell in conjunction with the
     fseek function to return to file locations correctly.
 
     On error, the function returns -1L. Also, errno is set to one of
     the following constants (defined in ERRNO.H): EBADF or EINVAL.
 
     The return value is undefined on devices incapable of seeking
     (such as terminals and printers) or when <stream> does not refer
     to an open file.
                                    -♦-