codescracker


c

C ftell()



« Previous Function Next Function »


ftell()

The ftell() function returns the current value of the file position indicator for specified stream. In the case of binary streams, the value is number of bytes the indicator is from the beginning of file. For text streams, return value may not be meaningful except as an argument to fseek() because of possible character translations, such as carriage return/linefeeds being substituted for the newlines, which affect the apparent size of file

ftell() Syntax

#include<stdio.h>
long int ftell(FILE *stream);

The ftell() returns -1 when an error occurs.

ftell() Example

Following c code obtains the current value of the file position indicator for the stream pointed to by fp :

long int i;
if((i=ftell(fp)) == -1L)
{
	printf("A file error has occurred..!!\n");
}

« Previous Function Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test