'\" t
.\" Title: modbus_strerror
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 10/15/2022
.\" Manual: libmodbus Manual
.\" Source: libmodbus v3.1.6
.\" Language: English
.\"
.TH "MODBUS_STRERROR" "3" "10/15/2022" "libmodbus v3\&.1\&.6" "libmodbus Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
modbus_strerror \- return the error message
.SH "SYNOPSIS"
.sp
\fBconst char *modbus_strerror(int \fR\fB\fIerrnum\fR\fR\fB);\fR
.SH "DESCRIPTION"
.sp
The \fBmodbus_strerror()\fR function shall return a pointer to an error message string corresponding to the error number specified by the \fIerrnum\fR argument\&. As libmodbus defines additional error numbers over and above those defined by the operating system, applications should use \fBmodbus_strerror()\fR in preference to the standard \fBstrerror()\fR function\&.
.SH "RETURN VALUE"
.sp
The \fBmodbus_strerror()\fR function shall return a pointer to an error message string\&.
.SH "ERRORS"
.sp
No errors are defined\&.
.SH "EXAMPLE"
.PP
\fBDisplay an error message when a Modbus connection cannot be established\fR.
.sp
.if n \{\
.RS 4
.\}
.nf
if (modbus_connect(ctx) == \-1) {
fprintf(stderr, "Connection failed: %s\en", modbus_strerror(errno));
abort();
}
.fi
.if n \{\
.RE
.\}
.sp
.SH "SEE ALSO"
.sp
linkmb:libmodbus
.SH "AUTHORS"
.sp
The libmodbus documentation was written by Stéphane Raimbault