LJM_ERROR_CONSTANTS_FILE is a string-based readable-writable LJM library configuration which sets the absolute or relative path of an existing file to use as error constants for use with the function LJM_ErrorToString.
The constant LJM_ERROR_CONSTANTS_FILE can be used interchangeably with the string "LJM_ERROR_CONSTANTS_FILE".
To set LJM_ERROR_CONSTANTS_FILE and LJM_MODBUS_MAP_CONSTANTS_FILE simultaneously, use LJM_CONSTANTS_FILE.
To read, use LJM_ReadLibraryConfigStringS.
To write, use LJM_WriteLibraryConfigStringS or LJM_LoadConfigurationFile.
[C/C++] Read LJM_ERROR_CONSTANTS_FILE, then set it to "alternate_error_constants.json"
char ErrorString[LJM_MAX_NAME_SIZE]; char defaultErrorConstantsFile[LJM_MAX_NAME_SIZE]; char * newErrorConstantsFile = "alternate_error_constants.json"; int LJMError = LJM_ReadLibraryConfigStringS(LJM_ERROR_CONSTANTS_FILE, defaultErrorConstantsFile); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_ReadLibraryConfigStringS error: %s\n", ErrorString); } printf("The default for LJM_ERROR_CONSTANTS_FILE is %s\n", defaultErrorConstantsFile); printf("Setting LJM_ERROR_CONSTANTS_FILE to %s\n", newErrorConstantsFile); LJMError = LJM_WriteLibraryConfigStringS(LJM_ERROR_CONSTANTS_FILE, newErrorConstantsFile); if (LJMError != 0) { LJM_ErrorToString(LJMError, ErrorString); printf("LJM_WriteLibraryConfigStringS error: %s\n", ErrorString); }
For more LJM configurations, see Library Configuration Functions.