FTELL

The FTELL function retrieves the current position of a file handle in bits.

Syntax

FTELL( FILE fileHandle )

Parameters

fileHandle
The file handle whose position is to be retrieved.

Return value

An INT value indicating the current position in bits of the file handle.

Example

The following example shows how one can determine the length of a file in bytes:

LOCAL FileLength(FILE fileHandle)(INT length)
  INT oldPos;

  // remember current position
  oldPos := FTELL(fileHandle);

  // seek to the end of the file
  FSEEK(fileHandle, 0, 2);

  // get length
  length := FTELL(fileHandle);

  // convert from bits to bytes
  length := length / 8;

  // return to the old position
  FSEEK(fileHandle, oldPos, 0);
END;

See Also