◄Up► ◄Contents► ◄Index► ◄Back► ─────Run-Time Library─────────────────────────────────────────────────────── /* HALLOC.C illustrates dynamic allocation of huge memory using functions: * _halloc _hfree */ #include <stdio.h> #include <malloc.h> #include <stdlib.h> void main() { char __huge *bigbuf, __huge *p; long count = 100000L; /* Allocate huge buffer (100,000 bytes). */ bigbuf = (char __huge *)_halloc( count, sizeof( char ) ); if( bigbuf == NULL ) { printf( "Insufficient memory" ); exit( 1 ); } /* Fill the buffer with characters. */ for( p = bigbuf; count; count--, p++ ) *p = (char)(count % 10) + '0'; /* Free huge buffer. */ _hfree( bigbuf ); exit( 0 ); } -♦-