gettext copies text from text-mode screen to memory
Declaration:
int gettext(int left, int top, int right, int bottom, void*destin);
Remarks:
gettext stores the contents of an onscreen text rectangle defined by
(left, top) and (right, bottom) into the area of memory *destin.
gettext reads the rectangle's contents into memory (and puttext puts the
stored contents into the rectangle) SEQUENTIALLY from left to right and top
to bottom.
Return Value:
On success,
gettext returns 1
On error, both functions return 0 (for
example, if you gave coordinates outside
the range of the current screen mode)
Program
#include <conio.h>
char buffer[4096];
int main(void)
{
int i;
clrscr();
for (i = 0; i <= 20; i++)
cprintf("Line #%d\r\n", i);
gettext(1, 1, 80, 25, buffer);
gotoxy(1, 25);
cprintf("Press any key to clear screen...");
getch();
clrscr();
gotoxy(1, 25);
cprintf("Press any key to restore screen...");
getch();
puttext(1, 1, 80, 25, buffer);
gotoxy(1, 25);
cprintf("Press any key to quit...");
getch();
return 0;
}
0 comments:
Post a Comment