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>_nmsize() return size of near memory block</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_nmsize()                Return Size of Near Memory Block

 #include   <malloc.h>                   Required for declarations only

 unsigned   int _nmsize(ptr);
 char near  ptr;                         Pointer to allocated near memory

    _nmsize() returns the number of bytes in the memory block pointed to
    by 'ptr'.  The block should have been allocated with _nmalloc().

    Returns:    Size in bytes of the memory block.

      Notes:    Use _msize() to get the size of blocks allocated with
                malloc(), calloc(), or realloc(). Use _fmsize() to get
                the size of blocks allocated with _fmalloc().

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

    The following statements allocate 500 bytes in a near data segment
    and then report the size of the allocated memory.

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

            char near *near_memptr;

            main()
            {
                if ((near_memptr = _nmalloc(500)) == NULL)
                    printf("not enough room to allocate memory\n");
                else
                    printf("%u bytes allocated\n", _nmsize(near_memptr));
            }

See Also: _nmalloc() _ffree() _fmsize() _msize() _nfree()

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