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

 #include   <malloc.h>

 unsigned   int _fmsize(ptr);
 char far   *ptr;                        Pointer to memory block

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

    Returns:    Size in bytes of the memory block.

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

                Use _nmsize() to get the size of blocks allocated with
                _nmalloc().

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

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

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

            char far *far_memptr;

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

See Also: _fmalloc() _ffree() _msize() _nmsize()

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