From c6ee76bacbcc02ba0ab0962d723850bc76d86b71 Mon Sep 17 00:00:00 2001 From: Daniele De Grazia Date: Thu, 6 Mar 2014 16:48:45 +0000 Subject: [PATCH] Change fname --- .../PostProcessing/ExtractSurface2DCFS.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/utilities/PostProcessing/ExtractSurface2DCFS.cpp b/utilities/PostProcessing/ExtractSurface2DCFS.cpp index b2382f565..1cbe25572 100644 --- a/utilities/PostProcessing/ExtractSurface2DCFS.cpp +++ b/utilities/PostProcessing/ExtractSurface2DCFS.cpp @@ -33,6 +33,23 @@ using namespace Nektar; int main(int argc, char *argv[]) { + string fname = std::string(argv[2]); + int fdot = fname.find_last_of('.'); + if (fdot != std::string::npos) + { + string ending = fname.substr(fdot); + + // If .chk or .fld we exchange the extension in the output file. + // For all other files (e.g. .bse) we append the extension to avoid + // conflicts. + if (ending == ".chk" || ending == ".fld") + { + fname = fname.substr(0,fdot); + } + } + + fname = fname + ".txt"; + int cnt; int id1, id2; int i, j, n, e, b; @@ -763,9 +780,6 @@ int main(int argc, char *argv[]) // Print the surface coordinates and the surface solution in a .txt file ofstream outfile; - string fname = strtok(argv[2],"."); - fname += ".txt"; - outfile.open(fname); outfile << "% x[m] " << " \t" << "y[m] " << " \t" -- GitLab