15
« on: May 04, 2012, 07:00:11 AM »
Konnichiwa,
Just wanted to ask a question about nCurses functions and how they are really messing me up. I want to save my screen, print some information (in this case, old messages), then restore the old screen. To do some tests, I started off with this (note this is the C programming language):
unsigned int line1;
unsigned int *ptr1 = &line1;
int count1;
int count2;
I made the pointer since both mvinchstr and mvaddchstr require a pointer for some reason. The two counts are for the nested for loops. Then:
mvinchstr(0, 0, ptr1);
/*Bleh put up old info blah whatever*/
for (count1 = 0; count1 < 34; count1++) {
for (count2 = 0; count2 < 142; count2++) {
mvaddch(count1, count2, ' ');
}
}
mvaddchstr(0, 0, ptr1);
So, in theory, this should copy the first line of the screen, put up the old messages, blank the screen, then put back the first line of the old screen again. However, I get this (I'm just testing it with a simple line for now):
Old Screen:
#
New Screen:
#
I've checked the output from both mvinchstr and mvaddchstr, and neither are erring. Mvinchstr is copying 142 characters (the length of the line I'm copying) and mvaddchstr is returning 0 (it would return -1 if it encountered an error). Anybody know what's going on?
If I run it piece by piece, mvinchstr runs fine, the old messages pop up fine, the screen clears fine, but mvaddchstr messes up.