Borland C++ reference

gettext

raw OCR

Copies text from text mode screen to memory.

Defined in header <conio.h>

Syntax

#include <conio.h>
int gettext(int  left, int top, int right, int bottom, void  *destin);

Portability

DOSUNIXWindowsANSI CC++ only
■

Remarks

gettext stores the contents of an onscreen text rectangle defined by left, top, right, and bottom into the area of memory pointed to by destin.

All coordinates are absolute screen coordinates, not window-relative. The upper left corner is (1,1).

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) x (zv columns) x 2

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

Example

#include <conio.h>

char buffer[4096];
int main (void)
{
   int i;
   clrscr 0;
   for (i = 0; i <= 20;  i++)
      cprintf ("Line #%d\r\n", i);
   gettext (1, 1, 80, 25, buffer);
   gotoxyd,  25);
   cprintf ("Press any key to clear screen...");
   getchO;
   clrscr 0;
   gotoxyil, 25);
   cprintf ("Press any key to restore screen...");
   getchO ;
   puttext (1, 1, 80, 25, buffer);
   gotoxy(l, 25) ;
   cprintf ("Press any key to quit...");
   getchO ;
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.