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>coreleft() return a measure of unused memory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 coreleft()              Return a Measure of Unused Memory

 #include   <alloc.h>
 #include   <stdlib.h>

 unsigned   coreleft(void);              In tiny, small, and medium models
 or
 unsigned long coreleft(void);           In compact, large, and huge models

    coreleft() returns the number of bytes of unused memory; this result
    varies according to the size of the memory model.

       Returns:     In small models, the amount of unused memory between
                    the stack and the data segment, minus 256 bytes is
                    returned.  In the large data models, the amount
                    between the heap and the stack is returned.

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

    The following statements display the amount of memory left.

           #include <stdio.h>      /* for printf */
           #include <alloc.h>      /* for coreleft */

           main()
           {
              unsigned long coresize;

               coresize = (unsigned long) coreleft();  /* for all models */
               printf("There are %ld bytes available\n",coresize);
           }


See Also: allocmem() calloc() farmalloc() free() malloc()

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