EPANET icon indicating copy to clipboard operation
EPANET copied to clipboard

Inability to pass literal strings to Toolkit functions in C++

Open LRossman opened this issue 3 years ago • 0 comments

In C++, in order to pass a literal character string into a function's argument the prototype has to declare the argument as const char*. Some Toolkit functions, like ENopen do this (so one can write ENopen("net1.inp", ...)) but there are 23 others that don't. An example is ENwriteline("Something something") which will cause the C++ compiler to throw an error. Does anyone see a downside to adding the const qualifier to the API function prototypes that take a character string as input?

Note: This only affects C++ code and not C code.

LRossman avatar Sep 09 '21 03:09 LRossman