Abusing `curses' WINDOW structure

Brian Yost yost at bty.UUCP
Sat Sep 20 15:19:49 AEST 1986


I have a question concerning termcap -vs- terminfo implementations
of the curses library.

I'm writing a program which uses the curses library, and need to
include a "print screen" type of utility.  Rather than reproducing
my display logic in order to print a text file image, I was thinking
of simply copying the screen from stdscr->_y directly into my textfile
(adding newlines where appropriate).  Something along these lines:

	PrintScr(f, win)
	FILE *f;
	WINDOW *win;
	{
		register short i, j;

		for (i = 0; i < win->_begy; i++)
			fputc('\n', f);

		for (i = 0; i < win->_maxy; i++) {
			for (j = 0; j < win->_begx; j++)
				fputc(' ', f);
			for (j = 0; j < win->_maxx; j++)
				fputc(win->_y[i][j], f);
			fputc('\n', f);
		}
		fflush(f);
	}

Now, my machine uses termcap, and this seems to work OK.  The question
is, is the WINDOW structure different in the terminfo implementation?
And if so, can the routine above be rewritten and made to work?

Please reply by mail, and thanks.

Brian Yost		 {clyde,topaz}!infopro!bty!yost

``This is a sic (sic) joke.''



More information about the Comp.lang.c mailing list