Source Code File 15-04_dumpwin
15-04_dumpwin.c
#include <ncurses.h>
#include <stdlib.h>
#include <time.h>
int main()
{
char word[7];
int x,w,r;
srandom((unsigned)time(NULL));
word[6] = '\0';
initscr();
/* add some random 6-char words */
for(x=0;x<200;x++)
{
for(w=0;w<6;w++)
word[w] = (random() % 26) + 'a';
printw("%s\t",word);
}
addstr("\nPress Enter to dump the screen");
refresh();
getch();
/* write the window */
r = scr_dump("dump.win");
if( r == ERR)
addstr("Error writing window");
else
addstr("File written; press Enter");
refresh();
getch();
endwin();
return(0);
}
Output Screenshot

Notes
* After the screen contents are written, the text File written; press Enter overwrites part of the text Press Enter to dump the screen.
Copyright © 1997-2025 by QPBC.
All rights reserved
