home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name mmsize -- Report program size.
- *
- * Synopsis size = mmsize();
- *
- * unsigned size Memory size of the program in
- * paragraphs, or zero if error from MMCTRL.
- *
- * Description This function reports the size of the memory block
- * occupied by the program's code and data. The size is
- * reported in units called paragraphs, which are sixteen
- * bytes long.
- *
- * Method We inspect the memory control block that governs the
- * memory block occupied by the program.
- *
- * Returns size Memory size of the program in
- * paragraphs, or zero if error from MMCTRL.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1987, 1989
- *
- **/
-
- #include <dos.h> /* For use with utpspseg. */
-
- #include <bmem.h>
- #include <butil.h>
-
- unsigned mmsize()
- {
- MEMCTRL ctlblock;
- unsigned nextblock;
- int ercode;
-
- ercode = mmctrl(utpspseg,&ctlblock,&nextblock);
- if (ercode == 0 || ercode == 18)
- return ctlblock.size;
- else
- return 0;
- }