ftell

Syntax

int ftell(FILE * file)

Arguments

file
A pointer to the file that you are working with (obtained with fopen).

Return

Returns the current position in the given file, or -1 if an error occurred.

Description

Returns the current position in the given file stream. You can use this in conjunction with fseek to get the size of a file by first seeking to the end of the file, then retrieving the current position with ftell.

See Also

fopen, fread, fseek, fwrite, fclose