modbus_strerror.txt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. modbus_strerror(3)
  2. =================
  3. NAME
  4. ----
  5. modbus_strerror - return the error message
  6. SYNOPSIS
  7. --------
  8. *const char *modbus_strerror(int 'errnum');*
  9. DESCRIPTION
  10. -----------
  11. The *modbus_strerror()* function shall return a pointer to an error message
  12. string corresponding to the error number specified by the _errnum_ argument. As
  13. libmodbus defines additional error numbers over and above those defined by the
  14. operating system, applications should use *modbus_strerror()* in preference to
  15. the standard *strerror()* function.
  16. RETURN VALUE
  17. ------------
  18. The *modbus_strerror()* function shall return a pointer to an error message
  19. string.
  20. ERRORS
  21. ------
  22. No errors are defined.
  23. EXAMPLE
  24. -------
  25. .Display an error message when a Modbus connection cannot be established
  26. [source,c]
  27. -------------------
  28. if (modbus_connect(ctx) == -1) {
  29. fprintf(stderr, "Connection failed: %s\n", modbus_strerror(errno));
  30. abort();
  31. }
  32. -------------------
  33. SEE ALSO
  34. --------
  35. linkmb:libmodbus
  36. AUTHORS
  37. -------
  38. The libmodbus documentation was written by Stéphane Raimbault
  39. <stephane.raimbault@gmail.com>