home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / waitne.zip / WAITSEC.CPP < prev    next >
C/C++ Source or Header  |  1995-01-04  |  1KB  |  38 lines

  1. /* waitsec.cpp
  2.  * This program is public domain.  Do whatever you want with it.  Use at your
  3.  * own risk.
  4.  *
  5.  * The purpose for this program is to wait a specified number of seconds
  6.  * before returning control. It helps in loading programs from the startup.cmd
  7.  * file.  If one program requires another, then you should figure out how long
  8.  * it takes to load the first program, and put a pause for that number of
  9.  * seconds between loading the first and second program.  The only parameter
  10.  * waitsec accepts is a number of seconds.
  11.  *
  12.  * WAITSEC was written and compiled with Borland C++ for OS/2 v1.5.
  13.  * Jeff Lamb, CIS:76256,2123
  14. */
  15. #define INCL_DOSPROCESS   // Process and thread values
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <os2.h>
  19.  
  20. void main(int argc,char *arg[])
  21. {
  22.   if(argc == 2)
  23.   {
  24.     ULONG TI = atoi(arg[1]);
  25.     APIRET  rc;            // Return code
  26.  
  27.     printf("\nWaiting about %i seconds...",TI);
  28.  
  29.     rc = DosSleep(TI*1000);
  30.  
  31.     if (rc != 0)
  32.       printf("DosSleep error: return code = %ld", rc);
  33.   }
  34.   else
  35.     printf("\nYou didn't specify a number of seconds\n");
  36.  
  37. }; // main()
  38.