-
Notifications
You must be signed in to change notification settings - Fork 0
gettext
Function Copies text from text mode screen to memory.
Syntax int gettext(int left, int top, int right, int bottom, void *destin);
Prototype in conio.h
Return value gettext returns 1 if the operation succeeds. It returns 0 if it fails (for example, if you gave coordinates outside the range of the current screen mode).
See also movetext, puttext
gettext stores the contents of an onscreen text rectangle defined by left, right, top, right, and bottom, into the area of memory pointed to by destin.
All coordinates are absolute screen coordinates, not window-relative.
gettext reads the contents of the rectangle into memory sequentially from left to right and top to bottom.
Each position onscreen takes 2 bytes of memory: The first byte is the character in the cell, and the second is the cell's video attribute. The space required for a rectangle w columns wide by h rows high is defined as
bytes = (h rows) × (w columns) × 2
char buf[20*10*2];
/* save rectangle */
gettext(1, 1, 20, 10, buf);
/* ... */
/* restore screen */
puttext(1, 1, buf);