12.07.2015 Views

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 16: Input and Output 133SEEK SETBuilt-in VariableSEEK CURBuilt-in VariableSEEK ENDBuilt-in VariableThese variables may be used as the optional third argument for the function fseek.SEEK_SET Position file relative to the beginning.SEEK_CUR Position file relative to the current position.SEEK_END used with fseek to position file relative to the end.frewind (fid)Built-in FunctionMove the file pointer to the beginning of the file fid, returning 0 for success, and -1 ifan error was encountered. It is equivalent to fseek (fid, 0, SEEK_SET).The following example stores the current file position in the variable marker, moves thepointer to the beginning of the file, reads four characters, and then returns to the originalposition.marker = ftell (myfile);frewind (myfile);fourch = fgets (myfile, 4);fseek (myfile, marker, SEEK_SET);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!