home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / FHEXP.ZIP / FHEXP.C < prev    next >
Text File  |  1992-11-22  |  1KB  |  43 lines

  1. /* This program changes the number of file handles that OS/2 provides it */
  2. /* and executes another program giving the environment to that process */
  3. /* Author: LaVern R. Ogden */
  4. /*   Date: 11/22/92 */
  5.  
  6. #define INCL_DOSFILEMGR
  7. #define INCL_DOSPROCESS
  8.  
  9. #include <os2.h>
  10. #include <stdio.h>
  11. #include <process.h>
  12.  
  13. static PID pidProc;
  14.  
  15. void main(int argc,char **argv) {
  16.   LONG ReqCount;  /* number to add to maximum handle count */
  17.   ULONG CurMaxFH; /* new count of handles */
  18.   APIRET rc;      /* return code */
  19.  
  20.   if (argc<3) {
  21.     printf("Not enough parameters were entered. Two or more are required.\n");
  22.     exit(0);
  23.   } 
  24.  
  25.   ReqCount=12;
  26.   rc=DosSetRelMaxFH(&ReqCount,&CurMaxFH);
  27.  
  28.   if (rc!=0) {
  29.     printf("DosSetRelMaxFH error: return code = %ld",rc);
  30.     return;
  31.   }
  32.  
  33. /*  printf("Number of available handles: %d\n",CurMaxFH); */
  34.  
  35.   pidProc = spawnvp(P_WAIT,argv[1], &argv[1]);
  36.   if (pidProc==-1) {
  37.     printf("Error occurred when running new process\n");  /* error occurred */
  38.   }
  39.  
  40.   return;
  41. }
  42.  
  43.