home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_06 / 8n06024a < prev    next >
Text File  |  1990-04-18  |  405b  |  28 lines

  1. *****Listing 1*****
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. main()
  7. {
  8.     FILE *out, *tmp;
  9.     char ch;
  10.  
  11.     printf("Enter A (abort), E (exit): ");
  12.     ch = getchar();
  13.  
  14.     tmp = tmpfile();
  15.     fwrite("abcdefgh\n", 1, 9, tmp);
  16.  
  17.     out = fopen("TEST.DAT", "w");
  18.     fprintf(out, "message to data file\n");
  19.  
  20.     fprintf(stderr, "error message to stderr\n");
  21.  
  22.     if (ch == 'A')
  23.         abort();
  24.     else
  25.         exit(0);
  26. }
  27.  
  28.