\section{FSEEK Seek File To A Given Position}

\subsection{Usage}

Moves the file pointer associated with the given file handle to 
the specified offset (in bytes).  The usage is
\begin{verbatim}
  fseek(handle,offset,style)
\end{verbatim}
The \verb|handle| argument must be a value and active file handle.  The
\verb|offset| parameter indicates the desired seek offset (how much the
file pointer is moved in bytes).  The \verb|style| parameter determines
how the offset is treated.  Three values for the \verb|style| parameter
are understood:
\begin{itemize}
\item  string \verb|'bof'| or the value -1, which indicate the seek is relative
to the beginning of the file.  This is equivalent to \verb|SEEK_SET| in
ANSI C.

\item  string \verb|'cof'| or the value 0, which indicates the seek is relative
to the current position of the file.  This is equivalent to 
\verb|SEEK_CUR| in ANSI C.

\item  string \verb|'eof'| or the value 1, which indicates the seek is relative
to the end of the file.  This is equivalent to \verb|SEEK_END| in ANSI
C.

\end{itemize}
The offset can be positive or negative.
\subsection{Example}

The first example reads a file and then ``rewinds'' the file pointer by seeking to the beginning.
The next example seeks forward by 2048 bytes from the files current position, and then reads a line of 512 floats.
\begin{verbatim}
--> % First we create the file
--> fp = fopen('test.dat','wb');
--> fwrite(fp,float(rand(4096,1)));
--> fclose(fp);
--> % Now we open it
--> fp = fopen('test.dat','rb');
--> % Read the whole thing
--> x = fread(fp,[1,inf],'float');
--> % Rewind to the beginning
--> fseek(fp,0,'bof');
--> % Read part of the file
--> y = fread(fp,[1,1024],'float');
--> who x y
  Variable Name      Type   Flags             Size
              x     float                    [1 4096]
              y     float                    [1 1024]
--> % Seek 2048 bytes into the file
--> fseek(fp,2048,'cof');
--> % Read 512 floats from the file
--> x = fread(fp,[512,1],'float');
--> % Close the file
--> fclose(fp);

\end{verbatim}
