home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / os2prgc.zip / dosmem.c < prev    next >
C/C++ Source or Header  |  1995-03-06  |  2KB  |  48 lines

  1. /*****************************************************************************
  2.  
  3.   DOSMEM.C -- Sample code for memory allocation with Dos...() API functions.
  4.   Copyright (C) 1993,94,95 by Craig Morrison, All Rights Reserved.
  5.  
  6.   You may use this code in your own projects, regardless of renumeration.
  7.   All I ask is that you prominently display the above copyright notice.
  8.  
  9.   Should you need assistance, I can be contacted at the following addresses:
  10.  
  11.         Fidonet:        Craig Morrison, 1:201/60@fidonet.org
  12.         Internet:       cam@wpc.cioe.com
  13.         Post:           Craig Morrison
  14.                         1316 Ferry St.
  15.                         Lafayette, IN 47901-1533
  16.                         USA
  17.  
  18.   NOTES:
  19.  
  20.     You'll notice the complete lack of any references to run-time
  21.     library functions. This was done on purpose so that *I* could
  22.     control what happens when a thread gets killed. This package
  23.     contains just about everything you'll need to do comm port/file
  24.     I/O, string manipulation and ordinal number conversions.
  25.  
  26.  *****************************************************************************/
  27. #define INCL_DOSMEMMGR
  28. #define INCL_NOPM
  29. #define INCL_BASE
  30.  
  31. #include <os2.h>
  32. #include <stdio.h>
  33.  
  34. PVOID AllocMem(ULONG ulMemAlloc, ULONG ulCommitFlags)
  35. {
  36.     PVOID pv = NULL;
  37.  
  38.     if (!DosAllocMem(&pv, ulMemAlloc, ulCommitFlags))
  39.         return(pv);
  40.     else
  41.         return NULL;
  42. }
  43.  
  44. VOID FreeMem(PVOID mem)
  45. {
  46.     DosFreeMem(mem);
  47. }
  48.