ftell

·

ftell takes a file pointer and returns a number of type long that corresponds to the current position. This function is useful in saving the current position of a file, which can be used later in the program. It takes the following form:-

n = ftell(fp);
n would give the relative offset(in bytes) of the current position. This means that n bytes have already been read (or written).

rewind takes a file pointer and resets the position to the start of the file.
for e.g.
rewind(fp);
n = ftell(fp);
n would return 0

About Me

Blog Archive