Share this page

# ftell

File Manipulation Functions

Returns the current file position of the given stream.

    long int ftell( FILE *stream )

stream | The pointer to a FILE object that identifies the stream.

For ftell details, refer to your C language documentation.

## Return Values

Returns the current value of the position indicator. On error, returns -1 and the global variable errno is set to a positive value.

## Example

    #include <stdio.h>

    FILE* fileHandle;
    int fileLen;

    if ((fileHandle = fopen(lr_eval_string("{FilePath}"),  "rb+")) == NULL)  {
        lr_error_message ("Cannot open file %s", lr_eval_string("{FilePath}"));
        lr_abort();
    }

    fseek(fileHandle, 0, SEEK_END);
    fileLen=ftell(fileHandle);

    fseek(fileHandle, 0, SEEK_SET);
    lr_output_message("File name: %s", lr_eval_string("{FilePath}"));
    lr_output_message("File length is: %9d bytes.", fileLen);

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: