Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>gettext() copy text from screen to memory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 gettext()               Copy Text From Screen to Memory

 #include <conio.h>

 int        gettext(left,top,right,bottom,dest);
 int        left;
 int        top;
 int        right;
 int        bottom;
 void       *dest;

    gettext() copies the contents of a rectangular screen area bordered
    by absolute screen coordinates ('left','top'), ('right','bottom')
    into an area of memory pointed to by 'dest'.  The contents of the
    screen area are read sequentially from left to right, top to bottom.

    The number of bytes of memory needed to store the screen information
    is:

          #bytes = ('right' - 'left') x ('bottom' - 'top') x 2

    This is because each screen position takes 2 bytes of memory. (The
    first byte is the cell character and the second is the cell's video
    attribute.)

       Returns:     1, if successful. 0 is returned on failure.

   Portability:     IBM PC and BIOS compatibles only.

   -------------------------------- Example ---------------------------------

    The following statements fill part of the screen with characters,
    store those characters in memory and put them back on the screen in a
    different place.

           #include <conio.h>

           main()
           {
               char buffr[20*10*2];
               int x, y;

               for (y = 0; y < 9; y++) {
                   for (x = 0; x < 19; x++)
                       printf("d");
                   printf("\n");
               }
               gettext(1,1,20,10,buffr);
               getch();
               clrscr();
               puttext(30,12,49,21,buffr);
           }


See Also: movetext() puttext()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson