modbus_strerror


 

Function

 

Retrieves the error message.

 

Format

 

error_string = modbus_strerror( errnum )

 

Parameters

 

errnum [ VB.NET: Integer ] [ C, C++: int ] [ C#: int ] [ Python: ctypes.c_int ]

Specify errnum.

 

Return values

 

error_string [ VB.NET: IntPtr ] [ C, C++: char * ] [ C#: string ] [ 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.

Errnum can be obtained with the modbus_read_errno function.

 

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.

 

VB.NET

Dim error_string As String

error_string = modbus_strerror(errno)

 

C, C++

char error_string[256];

error_string = modbus_strerror(errno);

 

C#

string error_string;

error_string = modbus.StrError(errno);

 

Python

err_str = ctypes.create_string_buffer(256)

err_str.value = modbus.modbus_strerror(errno)