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 119‘a’‘r+’‘w+’‘a+’Open or create a file for writing at the end of the file.Open an existing file for reading and writing.Open a file for reading or writing. The previous contents are discarded.Open or create a file for reading or writing at the end of the file.Append a "t" to the mode string to open the file in text mode or a "b" to open inbinary mode. On Windows and Macintosh systems, text mode reading and writingautomatically converts linefeeds to the appropriate line end character for the system(carriage-return linefeed on Windows, carriage-returnn on Macintosh). The defaultif no mode is specified is binary mode.The parameter arch is a string specifying the default data format for the file. Validvalues for arch are:‘native’ The format of the current machine (this is the default).‘ieee-be’ IEEE big endian format.‘ieee-le’ IEEE little endian format.‘vaxd’ VAX D floating format.‘vaxg’ VAX G floating format.‘cray’ Cray floating format.however, conversions are currently only supported for ‘native’ ‘ieee-be’, and‘ieee-le’ formats.fclose (fid)Built-in FunctionCloses the specified file. If successful, fclose returns 0, otherwise, it returns -1.16.2.2 Simple Outputfputs (fid, string)Write a string to a file with no formatting.Return a non-negative number on success and EOF on error.Built-in Functionputs (string)Write a string to the standard output with no formatting.Return a non-negative number on success and EOF on error.Built-in Function16.2.3 Line-Oriented Inputfgetl (fid, len)Built-in FunctionRead characters from a file, stopping after a newline, or EOF, or len characters havebeen read. The characters read, excluding the possible trailing newline, are returnedas a string.If len is omitted, fgetl reads until the next newline character.If there are no more characters to read, fgetl returns −1.

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

Saved successfully!

Ooh no, something went wrong!