1 /**************************************************************** 2 * FUNCTION define - specifies the geometric and operational * 3 * parameters of the Stirling cycle machine. * 4 * FILENAME: define.c * 5 * PROGRAMMER: izzi urieli * 6 * DATE: 12/02/95 * 7 * LAST MODIFICATION: 12/26/96 by I Urieli * 8 * INCLUDE: , , "define.h" * 9 * GLOBAL VARIABLES: * 10 * FILE *infile - pointer to the input data file * 11 * FILE *outfile - pointer to the output data file * 12 * FILE *printfile - pointer to the print output file * 13 * PROTOTYPE: void define(void); * 14 * PRE: none * 15 * POST: infile, outfile, printfile have been determined, and * 16 * global machine geometry and operating parameters specified * 17 ****************************************************************/ 18 #include 19 #include 20 #include "define.h" 21 void define(void) 22 { 23 char new, filename[11]; 24 printfile = fopen("print.data", "w"); 25 if(printfile == NULL) { 26 printf("\"printfile\" could not be opened\n"); 27 exit(1); 28 } 29 printf("create a new data file? (y/n): "); 30 new = getchar(); 31 fflush(stdin); 32 if (new == 'y') { 33 printf("enter the data filename (max 10 chars): "); 34 scanf("%10s", filename); 35 fprintf(printfile,"\nnew data filename: %s \n",filename); 36 outfile = fopen(filename, "w"); 37 if (outfile == NULL) { 38 printf("\"%s\" could not be opened\n", filename); 39 exit(2); 40 } 41 infile = stdin; 42 } 43 else { 44 printf("enter the input data filename (max 10 chars): "); 45 scanf("%10s", &filename); 46 fprintf(printfile,"\ninput data filename: %s\n", filename); 47 infile = fopen(filename, "r"); 48 if (infile == NULL) { 49 printf("\"%s\" could not be opened\n", filename); 50 exit(3); 51 } 52 outfile = stdout; 53 } 54 engine(); 55 heatex(); 56 gas(); 57 operat(); 58 } condor{t.gentry}6: