home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_10 / 8n10088c < prev    next >
Text File  |  1990-07-22  |  666b  |  26 lines

  1.  
  2. ******
  3. Listing 6
  4.  
  5. /* Write to printer, file, or nowhere using stdprn */
  6.  
  7.           if (where_to_go == GO_TO_PRINTER)
  8.                file_printer = stdprn;
  9.            else if (where_to_go == GO_TO_DISK_FILE)
  10.                file_printer = fopen(filename, "w");
  11.           else
  12.                /* Dump to a Nul file */
  13.                file_printer = fopen(NULL_DEVICE,"w");           
  14.  
  15.           /* print the line */ 
  16.           fprintf (file_printer, "The answer is %10d", z);
  17.  
  18.           /* close the printer, if it is not the real printer */
  19.           if (where_to_go != GO_TO_PRINTER)
  20.              fclose (file_printer);
  21.  
  22.           }
  23.  
  24. *******
  25.  
  26.