
#use wml::openssl-macros area=docs page=ERR_error_string

<title>Documents, ERR_error_string(3)</title>

<h1>ERR_error_string(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
	<LI><A HREF="#HISTORY">HISTORY</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
ERR_error_string, ERR_error_string_n, ERR_lib_error_string,
ERR_func_error_string, ERR_reason_error_string - obtain human-readable
error message

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/err.h&gt;
</PRE>
<PRE> char *ERR_error_string(unsigned long e, char *buf);
 void ERR_error_string_n(unsigned long e, char *buf, size_t len);
</PRE>
<PRE> const char *ERR_lib_error_string(unsigned long e);
 const char *ERR_func_error_string(unsigned long e);
 const char *ERR_reason_error_string(unsigned long e);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>ERR_error_string()</CODE> generates a human-readable string
representing the error code <EM>e</EM>, and places it at <EM>buf</EM>. <EM>buf</EM> must be at least 120 bytes long. If <EM>buf</EM> is <STRONG>NULL</STRONG>, the error string is placed in a static buffer.
<CODE>ERR_error_string_n()</CODE> is a variant of
<CODE>ERR_error_string()</CODE> that writes at most <EM>len</EM> characters (including the terminating 0) and truncates the string if
necessary. For <CODE>ERR_error_string_n(),</CODE> <EM>buf</EM> may not be <STRONG>NULL</STRONG>.

</P>
<P>
The string will have the following format:

</P>
<PRE> error:[error code]:[library name]:[function name]:[reason string]
</PRE>
<P>
<EM>error code</EM> is an 8 digit hexadecimal number, <EM>library name</EM>,
<EM>function name</EM> and <EM>reason string</EM> are ASCII text.

</P>
<P>
<CODE>ERR_lib_error_string(),</CODE> <CODE>ERR_func_error_string()</CODE>
and <CODE>ERR_reason_error_string()</CODE> return the library name,
function name and reason string respectively.

</P>
<P>
The OpenSSL error strings should be loaded by calling
<A HREF="../crypto/ERR_load_crypto_strings.html#">ERR_load_crypto_strings(3)</A> or, for SSL applications, <A HREF="../crypto/ERR_load_crypto_strings.html#">SSL_load_error_strings(3)</A>
first. If there is no text string registered for the given error code, the
error string will contain the numeric code.

</P>
<P>
<A HREF="../crypto/ERR_print_errors.html#">ERR_print_errors(3)</A> can be used to print all error codes currently in the queue.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
<CODE>ERR_error_string()</CODE> returns a pointer to a static buffer
containing the string if <EM>buf</EM>  <STRONG>== NULL</STRONG>, <EM>buf</EM> otherwise.

</P>
<P>
<CODE>ERR_lib_error_string(),</CODE> <CODE>ERR_func_error_string()</CODE>
and <CODE>ERR_reason_error_string()</CODE> return the strings, and <STRONG>NULL</STRONG> if none is registered for the error code.

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../crypto/err.html#">err(3)</A>, <A HREF="../crypto/ERR_get_error.html#">ERR_get_error(3)</A>,
<A HREF="../crypto/ERR_load_crypto_strings.html#">ERR_load_crypto_strings(3)</A>,
<A HREF="../crypto/ERR_load_crypto_strings.html#">SSL_load_error_strings(3)</A>

<A HREF="../crypto/ERR_print_errors.html#">ERR_print_errors(3)</A>



</P>
<P>
<HR>
<H1><A NAME="HISTORY">HISTORY</A></H1>
<P>
<CODE>ERR_error_string()</CODE> is available in all versions of SSLeay and
OpenSSL. <CODE>ERR_error_string_n()</CODE> was added in OpenSSL 0.9.6.

</P>
:}

