Write the syntax and explain the purpose of the following functions : 2m Dec2005
(i) Fseek( )
The C library function int fseek(FILE *stream, long int offset, int whence) sets the file position of the stream to the given offset.
Following is the declaration for fseek() function.
Parametersint fseek(FILE *stream, long int offset, int whence)
- stream — This is the pointer to a FILE object that identifies the stream.
- offset — This is the number of bytes to offset from whence.
- whence — This is the position from where offset is added. It is specified by one of the following constants:
Beginning of file
Current position of the file pointer
End of file
This function returns zero if successful, else it returns nonzero value.