scr_dump, scr_init, scr_restore, scr_set Subroutine

Purpose

File input/output functions.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>

int scr_dump
(const char *filename);

int scr_init
(const char *filename);

int scr_restore
(const char *filename);

int scr_set
(const char *filename);

Description

The scr_dump subroutine writes the current contents of the virtual screen to the file named by filename in an unspecified format.

The scr_restore subroutine sets the virtual screen to the contents of the file named by filename, which must have been written using the scr_dump subroutine. The next refresh operation restores the screen to the way it looked in the dump file.

The scr_init subroutine reads the contents of the file named by filename and uses them to initialize the Curses data structures to what the terminal currently has on its screen. The next refresh operation bases any updates of this information, unless either of the following conditions is true:

  • The terminal has been written to since the virtual screen was dumped to filename.
  • The terminfo capabilities rmcup and nrrmc are defined for the current terminal.

The scr_set subroutine is a combination of scr_restore and scr_init subroutines. It tells the program that the information i the file named by filename is what is currently on the screen, and also what the program wants on the screen. This can be thought of as a screen inheritance function.

Parameters

Item Description
filename  

Return Values

Upon successful completion, these subroutines return OK. Otherwise, they return ERR.

Examples

For the scr_dump subroutine:

To write the contents of the virtual screen to /tmp/virtual.dump file, use:

scr_dump("/tmp/virtual.dump");

For the scr_restrore subroutine:

To restore the contents of the virtual screen from the /tmp/virtual.dump file and update the terminal screen, use:

scr_restore("/tmp/virtual.dump");
doupdate();