SourcePoint Intel Help

Table of Contents

ftell

Return the current offset within a file.

Syntax

[result =] ftell(file_handle)

Where:

result

specifies a debug variable of type int4 to which the function return value is assigned. If result is not specified, the return value is displayed on the next line of the screen.

file_handle

is the file handle returned from a previous fopen command.

Discussion

The ftell function takes a file that is open for input or output and returns the position in the file.  The return value is -1 if an error occurs.

Example

To determine the size of a file:

Command input:

define int4 hFile = fopen("test.dat", "r")

fseek(hFile, 0, 2)      // seek to end of file

ftell(hFile)

Result:

000079A8H            // file size

Related Topics: