« Close

Datasheets and User Guides

App Notes

Software & Driver

 

LJM_ERROR_CONSTANTS_FILE

Summary

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".

Default Value

  • Windows Vista and later: "C:\ProgramData\LabJack\LJM\ljm_constants.json"
  • Windows XP: "C:\Documents and Settings\All Users\Application Data\LabJack\LJM\ljm_constants.json"
  • Mac OS X and Linux: "/usr/local/share/LabJack/LJM/ljm_constants.json"

Relevant Constants

To set LJM_ERROR_CONSTANTS_FILE and LJM_MODBUS_MAP_CONSTANTS_FILE simultaneously, use LJM_CONSTANTS_FILE.

Relevant Functions

To read, use LJM_ReadLibraryConfigStringS.

To write, use LJM_WriteLibraryConfigStringS or LJM_LoadConfigurationFile.

Example

[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.