From 8052ed0b6f5d8a2c2073e864d0cfbada37bd2e29 Mon Sep 17 00:00:00 2001 From: Lew Rossman Date: Tue, 5 Mar 2019 15:20:37 -0500 Subject: [PATCH] Walking back closing/opening output file --- src/epanet.c | 2 ++ src/report.c | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/epanet.c b/src/epanet.c index 45e6e6c..383bd6f 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -819,11 +819,13 @@ int DLLEXPORT EN_closeQ(EN_Project p) if (!p->Openflag) return 102; closequal(p); p->quality.OpenQflag = FALSE; +/* if (p->outfile.OutFile != NULL) { fclose(p->outfile.OutFile); p->outfile.OutFile = NULL; } +*/ return 0; } diff --git a/src/report.c b/src/report.c index 0032ee7..4d0c4df 100644 --- a/src/report.c +++ b/src/report.c @@ -545,11 +545,8 @@ int writeresults(Project *pr) if (nnv == 0 && nlv == 0) return errcode; // Return if no output file - if (outFile == NULL) - { - outFile = fopen(pr->outfile.OutFname, "r+b"); - if (outFile == NULL) return 106; - } +// if (outFile == NULL) outFile = fopen(pr->outfile.OutFname, "r+b"); + if (outFile == NULL) return 106; // Allocate memory for output variables: // m = larger of # node variables & # link variables @@ -590,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);