[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosAllocRealSeg()             Allocate conventional memory block.
------------------------------------------------------------------------------

 Function : Allocate a conventional memory block.

 Syntax   : USHORT BLXAPI DosAllocRealSeg(ULONG size,
            PUSHORT paragraph, PSEL selector);

 size       Size of the block to allocate in bytes (Cannot be greater than 64
            Kb).

 paragraph  Pointer to an integer to receive the real mode segment of the
            memory block.

 selector   Pointer to an integer to receive the protected mode
            selector of the memory block.

 Return   : The real mode paragraph address and the protected mode selector
            of the conventional memory block.

 As this function returns both a real mode paragraph address and a protected
 mode pointer the allocated block can be addressed in either mode, and can
 therefore be useful in mixed-mode programming.

 Example:

    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <blx286.h>
    void main(void)
    {
    SEL         selector;
    USHORT      paragraph;
    /* Allocate a 16KB block */
    if (DosAllocRealSeg((16L << 10), &paragraph, &selector) != 0)
       {
       printf("DosAllocRealSeg() failed\n");
       exit(255);
       }
    printf("Real segment: %04X prot selector: %04X\n",
       paragraph,selector);
    /* Free the block */
    DosFreeRealSeg(selector);
    }

See Also: DosFreeRealSeg()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson