Annotation of os2sdk/demos/examples/realloc/realloc.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Example of DOSREALLOCSEG.
                      3:  *
                      4:  * Shows how to allocate a segment, then change
                      5:  * it's size. DOSREALLOCSEG can be used to grow or
                      6:  * shrink a segment. Works Family API.
                      7:  *
                      8:  * Compile as:  cl -AL -G2 realloc.c
                      9:  *
                     10:  * Copyright (C) Microsoft Corp. 1986
                     11:  */
                     12: 
                     13: #include <doscalls.h>
                     14: 
                     15: #define NOTSHARED 0
                     16: 
                     17: main()
                     18: {
                     19:        unsigned segment;
                     20: 
                     21:        /* allocate a segment, 1024 bytes big */
                     22:        DOSALLOCSEG(1024, &segment, NOTSHARED);
                     23: 
                     24:        /* now grow it to 4000 bytes */
                     25:        DOSREALLOCSEG(4000, segment);
                     26: 
                     27:        /* now shrink it to 20 bytes */
                     28:        DOSREALLOCSEG(20, segment);
                     29: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.