Up: Terminal Output   [Contents][Index]


14.1.1.1 Paging Screen Output

When running interactively, Octave normally sends all output directly to the Command Window. However, when using the CLI version of Octave this can create a problem because large volumes of data will stream by before you can read them. In such cases, it is better to use a paging program such as less or more which displays just one screenful at a time. With less (and some versions of more) you can also scan forward and backward, and search for specific items. The pager is enabled by the command more on.

Normally, no output is displayed by the pager until just before Octave is ready to print the top level prompt, or read from the standard input (for example, by using the fscanf or scanf functions). This means that there may be some delay before any output appears on your screen if you have asked Octave to perform a significant amount of work with a single command statement. The function fflush may be used to force output to be sent to the pager (or any other stream) immediately.

You can select the program to run as the pager with the PAGER function, and configure the pager itself with the PAGER_FLAGS function.

more
more on
more off

Turn output pagination on or off.

Without an argument, more toggles the current state.

The current state can be determined via page_screen_output.

See also: page_screen_output, page_output_immediately, PAGER, PAGER_FLAGS.

val = PAGER ()
old_val = PAGER (new_val)
PAGER (new_val, "local")

Query or set the internal variable that specifies the program to use to display terminal output on your system.

The default value is normally "less", "more", or "pg", depending on what programs are installed on your system. See Installation.

When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function.

See also: PAGER_FLAGS, page_output_immediately, more, page_screen_output.

val = PAGER_FLAGS ()
old_val = PAGER_FLAGS (new_val)
PAGER_FLAGS (new_val, "local")

Query or set the internal variable that specifies the options to pass to the pager.

When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function.

See also: PAGER, more, page_screen_output, page_output_immediately.

val = page_screen_output ()
old_val = page_screen_output (new_val)
page_screen_output (new_val, "local")

Query or set the internal variable that controls whether output intended for the terminal window that is longer than one page is sent through a pager.

This allows you to view one screenful at a time. Some pagers (such as less—see Installation) are also capable of moving backward on the output.

When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function.

See also: more, page_output_immediately, PAGER, PAGER_FLAGS.

val = page_output_immediately ()
old_val = page_output_immediately (new_val)
page_output_immediately (new_val, "local")

Query or set the internal variable that controls whether Octave sends output to the pager as soon as it is available.

Otherwise, Octave buffers its output and waits until just before the prompt is printed to flush it to the pager.

When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function.

See also: page_screen_output, more, PAGER, PAGER_FLAGS.

fflush (fid)

Flush output to file descriptor fid.

fflush returns 0 on success and an OS dependent error value (-1 on Unix) on error.

Programming Note: Flushing is useful for ensuring that all pending output makes it to the screen before some other event occurs. For example, it is always a good idea to flush the standard output stream before calling input.

See also: fopen, fclose.


Up: Terminal Output   [Contents][Index]