PRODUCT : Borland C++ NUMBER : 660 VERSION : All OS : PC DOS DATE : October 19, 1993 PAGE : 1/1 TITLE : Dynamically Allocating >64K in Windows 3.0 In Windows the pointer returned by malloc() is really a selector. When you malloc() more than 64k, Windows will set up multiple selectors. To use the pointer you need to increment the offset until it reaches 0x0000 again (it always starts at 0x0000). You then need to add a constant value to the segment (Petzold says 8 for protected mode, 0x1000 for real mode. See page 295 of Windows 3.0 Power Programming.), which will give the next selector! For example: /* Must be far... huge pointers do not work */ char far *pfoo; /* 'pfoo' points to first 64k */ pfoo = (char far *) farmalloc (1000000ul); /* Advance to next segment */ while (FP_OFF (pfoo) != 0x0000) pfoo++; /* Now points to second 64K */ pfoo = MK_FP (FP_SEG (pfoo) + 8, 0x0000); DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.