Random access to files:

Sometimes it is required to access only a particular part of the and not the complete file. This can be accomplished by using the following function:

fseek function:

The general format of fseek function is a s follows:
fseek(file pointer,offset, position);

This function is used to move the file position to a desired location within the file. Fileptr is a pointer to the file concerned. Offset is a number or variable of type long, and position in an integer number. Offset specifies the number of positions (bytes) to be moved from the location specified bt the position.

The position can take the 3 values.
Value Meaning
0 Beginning of the file
1 Current position
2 End of the file.

The reference site for this content is http://www.exforsys.com/tutorials/c-language/file-management-in-c.html