Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/io/c/fseek"

From cppreference.com
< cpp‎ | io‎ | c
(+see c)
m (Text replace - "/sidebar" to "/navbar")
Line 1: Line 1:
 
{{cpp/title | fseek }}
 
{{cpp/title | fseek }}
{{cpp/io/c/sidebar}}
+
{{cpp/io/c/navbar}}
 
{{ddcl | header=cstdio |
 
{{ddcl | header=cstdio |
 
int fseek( FILE *stream, long offset, int origin );
 
int fseek( FILE *stream, long offset, int origin );

Revision as of 12:49, 15 June 2012

 
 
 
C-style I/O
Types and objects
Functions
File access
Direct input/output
Unformatted input/output
Formatted input
(C++11)(C++11)(C++11)    
(C++11)(C++11)(C++11)    
 
Defined in header <cstdio>
int fseek( FILE *stream, long offset, int origin );

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

Contents

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

Return value

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

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 std::ftell (only applicable to SEEK_SET).

See also

Template:cpp/io/c/dcl list fsetposTemplate:cpp/io/c/dcl list fgetposTemplate:cpp/io/c/dcl list ftellTemplate:cpp/io/c/dcl list rewind
C documentation for fseek