Namespaces
Variants
Views
Actions

fseek

From cppreference.com
< c‎ | io
Revision as of 22:36, 31 May 2013 by P12bot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Defined in header <stdio.h>
int fseek( FILE *stream, long offset, int origin );

Sets the file position indicator for the file stream stream to the value pointed to by offset. This function can be used to set the indicator beyond the actual end of the file, however, negative position values are not accepted.

Contents

[edit] Parameters

stream - file stream to modify
offset - number of characters to shift the position relative to origin
origin - position to which offset is added. It can have one of the following values: SEEK_SET, SEEK_CUR, SEEK_END

[edit] Return value

0 upon success, nonzero value otherwise. Associated EOF flag is cleared for the stream and the effect of any ungetc is undone.

[edit] Notes

For text streams, the only valid values of offset are 0 (applicable to any origin) and a value returned by an earlier call to ftell (only applicable to SEEK_SET).

[edit] See also

moves the file position indicator to a specific location in a file
(function) [edit]
gets the file position indicator
(function) [edit]
returns the current file position indicator
(function) [edit]
moves the file position indicator to the beginning in a file
(function) [edit]