NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |NOTES |PORTABILITY |SEE ALSO |COLOPHON | |
curs_scr_dump(3X)curs_scr_dump(3X)scr_dump,scr_restore,scr_init,scr_set- read (write) acurses screen from (to) a file
#include <curses.h>int scr_dump(const char *filename);int scr_restore(const char *filename);int scr_init(const char *filename);int scr_set(const char *filename);
scr_dump Thescr_dumproutine dumps the current contents of thevirtualscreen to the filefilename.scr_restore Thescr_restoreroutine sets thevirtual screen to the contents offilename, which must have been written usingscr_dump. The next call todoupdaterestores thephysical screen to the way it looked in the dump file.scr_init Thescr_initroutine reads in the contents offilename and uses them to initialize thecursesdata structures about what the ter‐ minal currently has on its screen. If the data is determined to be valid,cursesbases its next update of the screen on this in‐ formation rather than clearing the screen and starting from scratch.scr_initis used afterinitscr(3X) or asystem(3) call to share the screen with another process which has done ascr_dump after itsendwin(3X) call. The data is declared invalid • if the terminfo capabilitiesrmcupandnrrmcexist, also • if the terminal has been written to since the precedingscr_dumpcall.scr_set Thescr_setroutine is a combination ofscr_restoreandscr_init. It tells the program that the information infilename 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. To read (write) a window from (to) a file, use thegetwinandputwinroutines [seecurs_util(3X)].
All routines return the integerERRupon failure andOKupon suc‐ cess. X/Open defines no error conditions. In this implementation, each will return an error if the file cannot be opened.
Note thatscr_init,scr_set, andscr_restoremay be macros.
The XSI Curses standard, Issue 4, describes these functions (adding the const qualifiers). The SVr4 docs merely say underscr_initthat the dump data is also considered invalid "if the time-stamp of the tty is old" but do not define “old”.
curses(3X),curs_initscr(3X),curs_refresh(3X),curs_util(3X),scr_dump(5),system(3)
This page is part of thencurses (new curses) project. Informa‐ tion about the project can be found at ⟨https://www.gnu.org/software/ncurses/ncurses.html⟩. If you have a bug report for this manual page, send it to bug-ncurses-request@gnu.org. This page was obtained from the project's upstream Git mirror of the CVS repository ⟨https://github.com/mirror/ncurses.git⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2023-03-12.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgcurs_scr_dump(3X)HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |