/**************************************************************** * FUNCTION define - specifies the geometric and operational * * parameters of the Stirling cycle machine. * * FILENAME: define.c * * PROGRAMMER: izzi urieli * * DATE: 12/02/95 * * LAST MODIFICATION: 12/26/96 by I Urieli * * INCLUDE: , , "define.h" * * GLOBAL VARIABLES: * * FILE *infile - pointer to the input data file * * FILE *outfile - pointer to the output data file * * FILE *printfile - pointer to the print output file * * PROTOTYPE: void define(void); * * PRE: none * * POST: infile, outfile, printfile have been determined, and * * global machine geometry and operating parameters specified * ****************************************************************/ #include #include #include "define.h" void define(void) { char new, filename[11]; printfile = fopen("print.data", "w"); if(printfile == NULL) { printf("\"printfile\" could not be opened\n"); exit(1); } printf("create a new data file? (y/n): "); new = getchar(); fflush(stdin); if (new == 'y') { printf("enter the data filename (max 10 chars): "); scanf("%10s", filename); fprintf(printfile,"\nnew data filename: %s \n",filename); outfile = fopen(filename, "w"); if (outfile == NULL) { printf("\"%s\" could not be opened\n", filename); exit(2); } infile = stdin; } else { printf("enter the input data filename (max 10 chars): "); scanf("%10s", &filename); fprintf(printfile,"\ninput data filename: %s\n", filename); infile = fopen(filename, "r"); if (infile == NULL) { printf("\"%s\" could not be opened\n", filename); exit(3); } outfile = stdout; } engine(); heatex(); gas(); operat(); }