ldap_err2stringW function (winldap.h)

The ldap_err2string function converts a numeric LDAP error code into a null-terminated character string that describes the error.


  [in] ULONG err


[in] err

An LDAP error code as returned by another LDAP function.

Return value

If the function succeeds, a pointer to a null-terminated character string that describes the error, is returned.

If the function fails, a pointer to NULL is returned.


Call ldap_err2string to convert any numeric LDAP error code into an informative, null-terminated character string message that describes the error. Be aware that some of the asynchronous calls return -1. In this case, use LdapGetLastError to retrieve the LDAP error code, and then use ldap_err2string on that value.

The return value is a static pointer to the character string. Do not free this string.


The winldap.h header defines ldap_err2string as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header winldap.h
Library Wldap32.lib
DLL Wldap32.dll

See also


Return Values