ftell

Returns the current byte offset to the specified stream file.

Format

#include  <stdio.h>

long int ftell  (FILE *file_ptr);

Argument

file_ptr
A file pointer.

Description

This function measures the byte offset from the beginning of the file.

For variable-length files, VFC files, or any file with carriage- control attributes, it the file is opened in record mode, then ftell returns the starting position of the current record, not the current byte offset.

When using record files, the ftell function ignores any characters that have been pushed back using either ungetc or ungetwc. This behavior does not occur if stream files are being used.

For a portable way to measure the exact offset for any type of file, see the fgetpos function.

Return Values
The current offset. 
EOF  Indicates an error. 


Previous Page | Next Page | Table of Contents | Index