INtime SDK Help
ftell

Gets the current position of the file pointer for a stream.

#include <stdio.h>

long ftell (FILE *stream);

Parameters

stream
Pointer to FILE structure.

Remarks

When a file is opened for appending data, the last I/O operation determines the current file pointer position, not where the next write would occur. 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 pointer 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.

On devices incapable of seeking, such as terminals and printers, or when stream does not refer to an open file, the return value is undefined.

Return Values

The current file position expressed as an offset relative to the beginning of stream. The value returned may not reflect the physical byte offset for streams opened in text mode, since text mode causes <CR><LF> translation. Use ftell with fseek to return to file locations correctly.
Success.
-1L and the function sets errno to one of these values:
EBADF Bad file number. The stream argument is not a valid file descriptor value or does not refer to an open file.
EINVAL Invalid argument. An invalid stream argument was passed to the function.
Failure.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/stdio.h stdio.h clib.lib

See Also

fseek, lseek