Function
Retrieves the error message.
Format
error_string = modbus_strerror( errnum )
Parameters
errnum [ C : int ] [ Python : ctypes.c_int ]
Specify errnum.
Return values
error_string [ C : char * ] [ Python : ctypes.c_char_p ]
If the function succeeds, the error message corresponding to errnum is returned.
Remarks
The error message corresponding to the error number specified by errnum can be retrieved.
Please refer to each sample for the specific method of getting errno and getting the error content.
By using this function, in addition to what is defined in the OS, the error number message defined in libmodbus can also be retrieved.
Example
The error content corresponding to errno is stored in ErrorString.
C |
char error_string[256]; error_string = modbus_strerror(errno);
|
Python |
err_str = ctypes.create_string_buffer(256) err_str.value = modbus.modbus_strerror(errno)
|