From 14f4136406d7d141eb6a1222508cc7714aa94e8f Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Mon, 18 Oct 2021 16:57:30 -0400 Subject: [PATCH] Another try for more helpful error message from REFPROP --- src/sat_Z_accuracy.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sat_Z_accuracy.cpp b/src/sat_Z_accuracy.cpp index 837a921..81459c2 100644 --- a/src/sat_Z_accuracy.cpp +++ b/src/sat_Z_accuracy.cpp @@ -55,9 +55,10 @@ int REFPROP_setup() { bool loaded_REFPROP = load_REFPROP(err, path, DLL_name); printf("Loaded refprop: %s @ address %zu\n", loaded_REFPROP ? "true" : "false", REFPROP_address()); if (!loaded_REFPROP) { throw std::invalid_argument("Bad load of REFPROP"); } - SETPATHdll(const_cast<char*>(path.c_str()), 400); + char hpath[256]; strcpy(hpath, path + std::string(254-path.size(),'\0')); + SETPATHdll(hpath, 255); int ierr = 0, nc = 1; - char herr[256], hfld[10000] = "PROPANE", hhmx[255] = "HMX.BNC", href[4] = "DEF"; + char herr[256], hfld[10000] = "PROPANE ", hhmx[255] = "HMX.BNC", href[4] = "DEF"; SETUPdll(nc, hfld, hhmx, href, ierr, herr, 10000, 255, 3, 255); if (ierr != 0) { throw std::invalid_argument("Bad setup of REFPROP: "+std::string(herr)); } } -- GitLab