# fseek

## Purpose

Set file position indicator.

## Synopsis

    status = fseek(fid, offset, 'origin')

## Description

`status = fseek(fid,` `offset,` `'origin')` repositions the file position indicator in the specified file to the specified byte `offset` for the specified `origin`. `fid` is a integer file identifier obtained from `fopen`.

`offset` values are interpreted as follows:

    -------------------------------------------------------------------
    offset > 0  Move position indicator offset bytes toward the end
                   of the file.
    offset = 0     Do not change position.
    offset < 0  Move position indicator offset bytes toward the be
                   ginning of the file.
    -------------------------------------------------------------------

`origin` can be

    -------------------------------------
    'bof'  -1  Beginning of file.
    'cof'   0   Current position in file.
    'eof'   1   End of file.
    -------------------------------------

A `status` value for the operation is returned with value 0 on success and -1 on failure. If an error occurs, use the function `ferror` to get more information about the nature of the error.

## See Also

    fclose, ferror, fopen, fprint, fread, fscanf, ftell, fwrite, sprintf,
    sscanf

(c) Copyright 1994 by The MathWorks, Inc.