home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------ */
- /* ALLOCM1.C */
- /* shows conflict in memory allocation schemes */
- /* (c) 1990 Borland International */
- /* All rights reserved. */
- /* ------------------------------------------------------ */
- /* veröffentlicht in: DOS toolbox 2'92 */
- /* ------------------------------------------------------ */
-
- #include <alloc.h> // for farmalloc()
- #include <dos.h> // for allocmem()
- #include <stdio.h> // for printf()
-
- // ------------------------------------------------------- *
- main()
- {
- #pragma warn -aus // ptr IS assigned a value
- // that isn't used!
- unsigned seg, count = 0;
- char far *ptr;
-
- // allocates next available block
- allocmem(100, &seg);
- printf(" Allocated block at %X:0000\n", seg);
- while ((ptr = (char far*) farmalloc(50)) != NULL)
- count++;
-
- // can't allocate!
- printf(" Allocated %u 50 byte pieces\n", count);
-
- return 0;
- } // end of main()
- /* ------------------------------------------------------ */
- /* Ende von ALLOCM1.C */
-
-