-
Notifications
You must be signed in to change notification settings - Fork 275
Closed
Description
While trying to use this API Highs_getStringOptionValue I noticed that it's not easy or well designed because the user do not know how big the allocation need to be beforehand, probably would be better to return an allocated string instead and the user will be responsible to free it.
Or maybe add another parameter to pass the allocated size and also to return the string size, so we can check if we have allocated enough or not by checking the in_out_size if we get an error:
Something like:
HighsInt Highs_getStringOptionValue(const void* highs, const char* option,
char* value, HighsInt *in_out_size);
Actual implementation:
HighsInt Highs_getStringOptionValue(const void* highs, const char* option,
char* value) {
std::string v;
memset(value, 0, 7);
HighsInt retcode =
(HighsInt)((Highs*)highs)->getOptionValue(std::string(option), v);
strcpy(value, v.c_str());
return retcode;
}
Metadata
Metadata
Assignees
Labels
No labels