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>farcalloc() allocate memory from far heap</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 farcalloc()             Allocate Memory from Far Heap

 #include   <alloc.h>

 void far       *farcalloc(nunits,unitsz);
 unsigned long  nunits;                  Number of elements
 unsigned long  unitsz;                  Size of nunits

    farcalloc() allocates a block of memory from the far heap for an
    array of 'nunits' elements, each of which is 'unitsz' bytes long.
    Allocations from the far heap can include all of available RAM.
    farcalloc() allows blocks larger than 64K to be allocated. Use
    farfree() is to free blocks allocated with farcalloc().

       Returns:     A far pointer to the newly allocated block, if
                    successful; NULL if there is not enough space for the
                    new block.

         Notes:     The tiny model cannot have any segment fixups (which
                    are often produced by far pointers), and thus cannot
                    use farcalloc().

   Portability:     MS-DOS only.

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

    The following statements allocate space for an array of 70000
    integers and then deallocate the space.

           #include <alloc.h>           /* for farcalloc() and farfree() */
           #include <stdio.h>           /* for printf() and NULL */

           main()
           {
               int far *array;

               if ((array = farcalloc(70000L,(long)sizeof(int))) == NULL)
                   printf("Not enough memory to allocate");
               else {
                   .
                   .
                   /* use the memory */
                   printf("Memory allocated.");
                   farfree(array);              /* then deallocate it */
               }
           }


See Also: farmalloc() farcoreleft() farfree() farrealloc()

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