LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

fseek

fseek

int fseek (FILE *stream, long offset, int origin);

Purpose

Sets the file position indicator for the specified stream. The value specified by offset is added to the position designated by origin. A successful call to this function clears the end-of-file indicator for the stream and undoes any effects of ungetc on the same stream. After a call to this function, the next operation on an update stream (read/write or read/append) may be either input or output.

Note Note  This function is similar to fsetpos; however, fsetpos is more useful for huge files (over 2 billion bytes).

Parameters

Input
Name Type Description
stream FILE * Contains a pointer to the stream that has its associated file position indicator set.
offset long Contains the number of bytes beyond the designated origin to set the file position indicator. For binary files, this value is measured in characters and is added to the specified origin. For text files, one of the following must be true:

  • offset must be zero.
  • offset is the value returned by a previous call to ftell and origin is set to beginning-of-file.
origin int Contains the origin to which the specified offset is added in computing the new file position. The following describes the available selections:
Origin Value Description
Beginning SEEK_SET (0) Begin seek from beginning of file
Current SEEK_CUR (1) Begin seek from the current value of file position indicator
End SEEK_END (2) Begin seek from end of file

Return Value

Name Type Description
status int Contains the returned status of the function. If successful, fseek returns 0. If an error occurs, fseek returns a nonzero value and sets errno to a nonzero value.

Additional Information

Library: ANSI C Library

Include file: ansi_c.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Was this information helpful?

Previous

ftell

Previous

ftell