C Programming Tutorial
In the C Programming Language, the fseek function changes the file position indicator for the stream pointed to by stream.
Syntax
The syntax for the fseek function in the C Language is:
int fseek(FILE *stream, long int offset, int whence);
Parameters or Arguments
stream
The stream whose file position indicator is to be modified.
offset
The offset to use (in bytes) when determining the new file position.
whence
It can be one of the following values:
Value | Description |
---|---|
SEEK_SET | The new file position will be the beginning of the file plus offset (in bytes). |
SEEK_CUR | The new file position will be the current position plus offset (in bytes). |
SEEK_END | The new file position will be the end of the file plus offset (in bytes). |
Returns
The fseek function returns zero if successful. If an error occurs, the fseek function will return a nonzero value.
Required Header
In the C Language, the required header for the fseek function is:
#include <stdio.h>
Applies To
In the C Language, the fseek function can be used in the following versions:
- ANSI/ISO 9899-1990