home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / worldmap / demo / setopt.c < prev   
Text File  |  1986-01-21  |  1KB  |  45 lines

  1. /*  setopt  -  set the graphics driver and print device in the option file.
  2.  
  3.         Copyright 1986 John B. Allison                */
  4.  
  5. setopt(){
  6.  
  7. #include "\lc\stdio.h"
  8.  
  9.     FILE    *fp;
  10.  
  11.    char    gfilename[40], pfilename[40];
  12.    static char *fname = "demo.opt";
  13.    static char *form = "Format error in the contents of options file \"%s\"\n";
  14.  
  15.  
  16.  
  17.     /*  Choose the display device (e.g., IBM graphics card)
  18.         for Multi Halo                        */
  19.  
  20.     if((fp = fopen(fname, "ra")) == 0){
  21.         printf("Error opening options file %s\n", fname);
  22.         exit();
  23.     }
  24.  
  25.     if(fscanf(fp, "%s", gfilename) != 1){
  26.         printf(form, fname);
  27.         printf("Expecting \"FILENAME for graphics driver\"\n");
  28.         printf("where FILENAME is, for example, \\halo\\haloibm.dev\n");
  29.         exit();
  30.     }
  31.  
  32.     if(fscanf(fp, "%s", pfilename) != 1){
  33.         printf(form, fname);
  34.         printf("Expecting \"FILENAME for print device\"\n");
  35.         printf("where FILENAME is, for example, \\halo\\haloepsn.prn\n");
  36.         exit();
  37.     }
  38.  
  39.     fclose(fp);
  40.  
  41.     setprn(pfilename);        /*  Use this Halo print device  */
  42.     setdev(gfilename);        /*  Use this Halo graphics driver  */
  43.  
  44. }
  45.