fseek

Syntax

int fseek(FILE * file, long int offset, int origin)

Arguments

file
A pointer to the file that you are working with (obtained with fopen).
offset
The offset (usually in bytes, for binary files) that you want to seek to in the file, from the given origin.
origin
Designates whether to seek from the start (== 0), current position (== 1), or end (== 2) of the file.

Return

Zero if the operation succeeded, non-zero otherwise.

Description

Seeks within a file to the given position.

Example

Also see

fopen, fread, fsetpos, fwrite, fclose

Comments