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>_graphgetmem() allocate graphics memory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _graphgetmem()          Allocate Graphics Memory

 #include   <graphics.h>

 void far *far _graphgetmem(size);
 unsigned      size;

    _graphgetmem() allocates memory for internal buffers, graphics
    drivers and character sets.  You can control graphics memory
    allocation by defining your own version of _graphgetmem().  You must
    declare your _graphgetmem() function exactly the same as shown above.

    Returns:    Nothing.

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

    The following statements define a new _graphgetmem() function which
    initgraph() uses to allocate memory.

           #include <graphics.h>
           #include <alloc.h>
           #include <stdio.h>

           int far *gblock;

           main()
           {
               int gdriver = DETECT;
               int gmode;

               initgraph(&gdriver,&gmode,"");
               .
               .
              /* graphics operations */
               .
               .
               closegraph();
           }

           void far *far _graphgetmem(size)
           unsigned size;
           {
               if ((gblock = farmalloc(size)) != NULL)
                   printf("_graphgetmem allocated %u memory\n",size);
               else
                   printf("unable to allocate memory\n");
               getch();
               return(gblock);
           }

           void far _graphfreemem(ptr,size)
           void far *ptr;
           unsigned size;
           {
               printf("_graphfreemem called, amount freed = %d\n",size);
               getch();
               farfree(ptr);
           }


See Also: _graphfreemem()

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