Gets the current position of the file pointer for a stream.
#include <stdio.h> long ftell (FILE *stream);
stream
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.
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. |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/stdio.h | stdio.h | clib.lib |