File:  [OS/2 SDKs] / os2sdk / demos / examples / realloc / realloc.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:26:08 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: os2sdk-1988, HEAD
Microsoft OS/2 SDK 03-01-1988

/*
 * Example of DosReallocSeg.
 *
 * Shows how to allocate a segment, then change
 * it's size. DosReallocSeg can be used to grow or
 * shrink a segment. Works Family API.
 *
 * Compile as:	cl -AL -G0 -Lp realloc.c
 *
 * Created by Microsoft Corp. 1986
 */

#define INCL_DOSMEMMGR

#include <os2def.h>
#include <bsedos.h>

#define NOTSHARED 0

main()
{
	SEL segment;

	/* allocate a segment, 1024 bytes big */
	DosAllocSeg(1024, &segment, NOTSHARED);

	/* now grow it to 4000 bytes */
	DosReallocSeg(4000, segment);

	/* now shrink it to 20 bytes */
	DosReallocSeg(20, segment);
}

unix.superglobalmegacorp.com

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