Debian Codegraph @

docs/modbus_strerror.md

raw symbols SCIP
1 # modbus_strerror
2
3 ## Name
4
5 modbus_strerror - return the error message
6
7 ## Synopsis
8
9 ```c
10 const char *modbus_strerror(int errnum);
11 ```
12
13 ## Description
14
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.
20
21 ## Return value
22
23 The *modbus_strerror()* function shall return a pointer to an error message
24 string.
25
26 ## Errors
27
28 No errors are defined.
29
30 ## Example
31
32 Display an error message when a Modbus connection cannot be established
33
34 ```c
35 if (modbus_connect(ctx) == -1) {
36 fprintf(stderr, "Connection failed: %s\n", modbus_strerror(errno));
37 abort();
38 }
39 ```