fsetpos

fseek

#include <stdio.h>int fseek(FILE *stream, long int offset, int origin);

The fseek( ) function sets the file position indicator associated with stream according to the values of offset and origin. Its purpose is to support random access I/O operations. The offset is the number of bytes from origin to seek to. The values for origin must be one of these macros (defined in <stdio.h>):

Name

Meaning

SEEK_SET

Seek from start of file

SEEK_CUR

Seek from current location

SEEK_END

Seek from end of file

A return value of zero means that fseek( ) succeeded. A nonzero value indicates failure.

In general, fseek( ) should be used only with binary files. If used on a text file, then origin must be SEEK_SET and offset must be a value obtained by calling ftell( ) on the same file, or zero (to set the file position indicator to the start of the file).

The fseek( ) function clears the end-of-file flag associated with the specified stream. Furthermore, it nullifies any prior ungetc( ) on the same stream. See ungetc( ).

Related functions are ftell( ), rewind( ), fopen( ), fgetpos( ), and fsetpos( ).




C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net