home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / SPECIAL.C < prev    next >
Text File  |  1989-11-10  |  1KB  |  49 lines

  1.                                         /* Chapter 9 - Program 7 */
  2. #include "stdio.h"
  3. #include "stdlib.h"    /* Prototype for exit()                   */
  4.  
  5. int main()
  6. {
  7. int index;
  8.  
  9.    for (index = 0;index < 6;index++) {
  10.       printf("This line goes to the standard output.\n");
  11.       fprintf(stderr,"This line goes to the error device.\n");
  12.    }
  13.  
  14.    exit(4);  /* This can be tested with the DOS errorlevel
  15.                 command in a batch file. The number returned
  16.                 is used as follows;
  17.  
  18.                 IF ERRORLEVEL 4 GOTO FOUR
  19.                 (continue here if less than 4)
  20.                 .
  21.                 .
  22.                 GOTO DONE
  23.                 :FOUR
  24.                 (continue here if 4 or greater)
  25.                 .
  26.                 .
  27.                 :DONE
  28.                                                                   */
  29. }
  30.  
  31.  
  32.  
  33. /* Result of execution (without redirection)
  34.  
  35. This line goes to the standard output.
  36. This line goes to the error device.
  37. This line goes to the standard output.
  38. This line goes to the error device.
  39. This line goes to the standard output.
  40. This line goes to the error device.
  41. This line goes to the standard output.
  42. This line goes to the error device.
  43. This line goes to the standard output.
  44. This line goes to the error device.
  45. This line goes to the standard output.
  46. This line goes to the error device.
  47.  
  48. */
  49.