Category : C++ Source Code
Archive   : TCTNT.ZIP
Filename : ALLOCM1.C

 
Output of file : ALLOCM1.C contained in archive : TCTNT.ZIP
/* ALLOCM1.C: shows conflict in memory allocation schemes
*/

#include // for farmalloc()
#include // for allocmem()
#include // 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()


  3 Responses to “Category : C++ Source Code
Archive   : TCTNT.ZIP
Filename : ALLOCM1.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/