MATLAB Function Reference
  Go to function:
    Search    Help Desk 
fseek    See Also

Set file position indicator

Syntax

Description

status = fseek(fid,offset,origin) repositions the file position indicator in the file with the given fid to the byte with the specified offset relative to origin.

Arguments

fid
An integer file identifier obtained from fopen.
offset
A value that is 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 beginning of the file.
origin
A string whose legal values are:

'bof'
-1: Beginning of file.

'cof'
0: Current position in file.

'eof'
1: End of file.
status
A returned value that is 0 if the fseek operation is successful and -1 if it fails. If an error occurs, use the function ferror to get more information about the nature of the error.

See Also

fopen       Open a file or obtain information about open files

ftell       Get file position indicator



[ Previous | Help Desk | Next ]