home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / progjrn / pj_6_1.arc / LISTING5.C < prev    next >
Text File  |  1987-12-28  |  1KB  |  38 lines

  1.   /*  Trivial example using TIMER macros
  2.    *  Copyright Frank D. Greco, 1987
  3.    *  Page 50, Volume 6.1 Programmer's Journal
  4.    */
  5.   #include <stdio.h>
  6.   #include <process.h>
  7.   #include <dos.h>
  8.   #include "timer.h"
  9.   
  10.   main(argc,argv)
  11.   char **argv;
  12.   {
  13.       char *bp;                   /* Ptr to command to be spawned */
  14.       unsigned long gettime();    /* Gets clock ticks from MS-DOS */
  15.       int value;                  /* Arbitrary variable */
  16.       int i;                      /* Arbitrary variable */
  17.   
  18.       bp = argv[1];
  19.   
  20.       TIME(spawnvp(P_WAIT, bp, ++argv), bp);
  21.       TIME( value = 1 + 3 * 8, "value assign.");
  22.   
  23.       START();
  24.       for (i = 15; i--; )
  25.           fputs("hello",stdout),fputs(" world", stdout),fputs(" again\n",stdout);
  26.       STOP();
  27.       PRINT_TIME("puts()");
  28.   
  29.       TIME(
  30.       {   int i;
  31.           for ( i = 0; i < 300; i++)
  32.               putchar('X');
  33.       }, "for loop"
  34.           );
  35.       
  36.       exit(0);                    /* Good Housekeeping */
  37.   }
  38.