14.2 C-Style I/O Functions

Octave’s C-style input and output functions provide most of the functionality of the C programming language’s standard I/O library. The argument lists for some of the input functions are slightly different, however, because Octave has no way of passing arguments by reference.

In the following, file refers to a filename and fid refers to an integer file number, as returned by fopen.

There are three files that are always available. Although these files can be accessed using their corresponding numeric file ids, you should always use the symbolic names given in the table below, since it will make your programs easier to understand.

stdin ()

Return the numeric value corresponding to the standard input stream.

When Octave is used interactively, stdin is filtered through the command line editing functions.

See also: stdout, stderr.

stdout ()

Return the numeric value corresponding to the standard output stream.

Data written to the standard output may be filtered through the pager.

See also: stdin, stderr, page_screen_output.

stderr ()

Return the numeric value corresponding to the standard error stream.

Even if paging is turned on, the standard error is not sent to the pager. It is useful for error messages and prompts.

See also: stdin, stdout.

© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v5.2.0/C_002dStyle-I_002fO-Functions.html