#include #include #include #include "delta.h" /*************************************************************************** OpenFile(), This function opens a file. Arguments: char filename[20] filename char mode[1] open mode ( "r" or "w") Return Value: void ****************************************************************************/ void OpenFile(char *filename, char *mode) { if(*mode == 'r') { if ((fpin = fopen(filename, mode)) == NULL) { printf("\n\nCould not open %s. Terminated.\n", filename); exit(EXIT_FAILURE); } } else { if ((fpout = fopen(filename, mode)) == NULL) { printf("\n\nCould not open %s. Terminated.\n", filename); exit(EXIT_FAILURE); } } } /*************************************************************************** Screen Pause() This function pauses the output to the screen. Arguments: void Return Value: void ****************************************************************************/ void ScreenPause(void) { char c; for(EVER) { printf("\nPress any key to continue: "); c = getchar(); if(c) { break; } } } /*************************************************************************** PrintTime() This function prints a time to the screen in the format hours:minutes:seconds. Arguments: long time Return Value: void ****************************************************************************/ void PrintTime(long time) { struct Time run; double d,h,m; run.init[0] = (time); d = (double)run.init[0]; h = (d-(double)(run.init[0]%3600))/3600; m = ((double)((run.init[0]%3600)-(run.init[0]%60)))/60; run.seconds[0] = run.init[0]%60; run.minutes[0] = (long)m; run.hours[0] = (long)h; printf("\n\nRuntime = %ld:%ld:%ld",run.hours[0],run.minutes[0],run.seconds[0]); }