This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/setblock.c

24 lines
658 B
C

#include <stdio.h>
#include <dos.h>
void main( void )
{
unsigned segment;
unsigned maxsize;
/* Try to allocate 100 paragraphs, then free them */
if( _dos_allocmem( 100, &segment ) != 0 ) {
printf( "_dos_allocmem failed\n" );
printf( "Only %u paragraphs available\n", segment);
} else {
printf( "_dos_allocmem succeeded\n" );
/* Try to increase it to 200 paragraphs */
if( _dos_setblock( 200, segment, &maxsize ) != 0 ) {
printf( "Unable to increase the size\n" );
}
if( _dos_freemem( segment ) != 0 ) {
printf( "_dos_freemem failed\n" );
}
}
}