From 324487ba86725e0e6443b8928b6f6ed44830f00b Mon Sep 17 00:00:00 2001 From: Lew Rossman Date: Tue, 5 Mar 2019 19:40:30 -0500 Subject: [PATCH] Opening & closing output file in writeresults --- src/project.c | 13 ------------- src/report.c | 6 +++--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/project.c b/src/project.c index 0a40489..b66117c 100644 --- a/src/project.c +++ b/src/project.c @@ -185,19 +185,6 @@ int openoutfile(Project *pr) // If output file name was supplied, then attempt to // open it. Otherwise open a temporary output file. -/* - if (pr->outfile.Outflag == SAVE) - { - pr->outfile.OutFile = fopen(pr->outfile.OutFname, "w+b"); - if (pr->outfile.OutFile == NULL) errcode = 304; - } - else - { - strcpy(pr->outfile.OutFname, pr->TmpOutFname); - pr->outfile.OutFile = fopen(pr->outfile.OutFname, "w+b"); - if (pr->outfile.OutFile == NULL) errcode = 304; - } -*/ pr->outfile.OutFile = fopen(pr->outfile.OutFname, "w+b"); if (pr->outfile.OutFile == NULL) errcode = 304; diff --git a/src/report.c b/src/report.c index 790aac8..5605ffb 100644 --- a/src/report.c +++ b/src/report.c @@ -545,7 +545,7 @@ int writeresults(Project *pr) if (nnv == 0 && nlv == 0) return errcode; // Return if no output file -// if (outFile == NULL) outFile = fopen(pr->outfile.OutFname, "rb"); + if (outFile == NULL) outFile = fopen(pr->outfile.OutFname, "rb"); if (outFile == NULL) return 106; // Allocate memory for output variables: @@ -587,14 +587,14 @@ int writeresults(Project *pr) time->Htime += time->Rstep; } } -/* + // Free output file if (outFile != NULL) { fclose(outFile); outFile = NULL; } -*/ + // Free allocated memory for (j = 0; j < m; j++) free(x[j]); free(x);