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

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

unix.superglobalmegacorp.com

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