Source Code File 15-07_wgetfile
15-07_wgetfile.c
#include <ncurses.h> int main() { FILE *wfile; WINDOW *win; initscr(); start_color(); init_pair(1,COLOR_WHITE,COLOR_RED); refresh(); /* open file */ wfile = fopen("window.win","r"); if( wfile==NULL ) { endwin(); puts("Error reading file"); return(1); } /* read window's data */ win = getwin(wfile); fclose(wfile); wrefresh(win); getch(); endwin(); return(0); }
Output Screenshot
Notes
* As I wrote in the book, the window's color changes because the COLOR_PAIR(1)
attribute is defined differently in this code.
Copyright © 1997-2024 by QPBC.
All rights reserved