home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sftick.zip / beg / mem / mem.C < prev    next >
Text File  |  1994-04-09  |  722b  |  34 lines

  1. #define INCL_DOSMEMMGR
  2.  
  3. #include <os2.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. int main ( VOID )
  8. {
  9.    PBYTE          pbBuffer = 0;
  10.    APIRET         arReturn ;
  11.    USHORT         usIndex ;
  12.  
  13.    /* allocate some memory */
  14.    arReturn = DosAllocMem (( PPVOID ) &pbBuffer,
  15.                              10,
  16.                              PAG_READ | PAG_WRITE  ) ;
  17.  
  18.    /* if OK */
  19.    if ( arReturn == 0 ) {
  20.  
  21.         /* loop 0-10, writing to the allocated memory */
  22.       for ( usIndex = 0 ; usIndex < 10 ; usIndex++ ) {
  23.  
  24.           if (pbBuffer[usIndex])
  25.              pbBuffer [usIndex] = 1 ;
  26.           printf("\nusIndex = %d",usIndex ) ;
  27.  
  28.       } /* endfor */
  29.  
  30.    } /* endif */
  31.  
  32.    return 0 ;
  33. }
  34.