Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>_nmalloc() allocate near memory block</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_nmalloc()               Allocate Near Memory Block

 #include   <malloc.h>

 char       near *_nmalloc(size);
 unsigned   size;                        Number of bytes to allocate

    _nmalloc() allocates a block of 'size' bytes in the default data
    segment.

    Returns:    Pointer to allocated space.  Returns NULL (defined in
                <stdio.h>) if the space cannot be allocated.

      Notes:    Use _nfree() to deallocate block allocated with
                _nmalloc().

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

    The following statements allocate space for 1000 bytes in the default
    data segment and then free the allocated space:

           #include <malloc.h>
           #include <stdio.h>      /* for printf and NULL */

           char near *near_memptr;

           main()
           {
               if ((near_memptr = _nmalloc(1000)) == NULL)
                    printf("not enough room to allocate memory\n");
               else {
                    .
                    .
                    _nfree(near_memptr);
                }
           }

See Also: _nfree() _nmsize() malloc() _fmalloc()

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