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

 #include   <graphics.h>

 void far   _graphfreemem(ptr,size);
 void far   *ptr;
 unsigned   size;

    _graphfreemem() deallocates memory previously allocated with
    _graphgetmem(). By defining your own version of _graphfreemem() you
    can override the default function with the same name in the C++
    library.  _graphfreemem() must be declared exactly the same as shown
    above.

    Returns:    Nothing.

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

    The following statements define a new _graphfreemem() function which
    closegraph() uses to deallocate 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: _graphgetmem()

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