5 modbus_strerror - return the error message
10 const char *modbus_strerror(int errnum);
15 The *modbus_strerror()* function shall return a pointer to an error message
16 string corresponding to the error number specified by the `errnum` argument. As
17 libmodbus defines additional error numbers over and above those defined by the
18 operating system, applications should use *modbus_strerror()* in preference to
19 the standard *strerror()* function.
23 The *modbus_strerror()* function shall return a pointer to an error message
28 No errors are defined.
32 Display an error message when a Modbus connection cannot be established
35 if (modbus_connect(ctx) == -1) {
36 fprintf(stderr, "Connection failed: %s\n", modbus_strerror(errno));