
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_dos_freemem() free a block of memory</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_dos_freemem() Free a block of memory
#include <dos.h>
unsigned _dos_freemem(segment);
unsigned segment; Segment address of block to be released
_dos_freemem() uses MS-DOS function call 49h to free a block of
memory that was previously allocated by _dos_allocmem(). 'Segment' is
the address originally returned by _dos_allocmem(). Once the block
has been freed it is no longer available to the application program.
Returns: If the memory was successfully allocated _dos_allocmem()
returns 0. If unsuccessful it returns the MS-DOS error
code and sets errno to ENOMEM. The MS-DOS error code will
be one of the following:
07h = memory control blocks damaged
09h = memory block was not originally allocated with
48h, so cannot be freed with function request 49h
Notes: In MS-DOS 3.0, or higher dosexterr() can be used for
extended error code information.
Portability: MS-DOS only, version 2.0 or higher
------------------------------- Example ---------------------------------
This program frees a block of memory previously allocated by _dos_allocmem()
#include <dos.h>
unsigned segment;
main()
{
unsigned err_code;
.
.
err_code = _dos_freemem(segment);
if (err_code)
printf("Error code = %u\n", err_code);
.
.
}
See Also: _dos_allocmem() _dos_setblock() dosexterr()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson