iconv_open -- Create Conversion Descriptor

Format

#include <iconv.h>
iconv_t iconv_open(const char *tocode, const char *fromcode);

Language Level: XPG4
iconv_open performs all the initialization needed to convert characters from the encoded character set named by fromcode to the encoded character set named by tocode. It creates a conversion descriptor that relates the two encoded character sets. You can then use the conversion descriptor with the iconv function to convert characters between the codesets.

The conversion descriptor remains valid until you close it with iconv_close.

Returned Value
If successful, iconv_open returns a conversion descriptor of type iconv_t. Otherwise, it returns (iconv_t)-1, and sets errno to indicate the error. If you cannot convert between the encoded character sets specified, an error occurs and iconv_open sets errno to EINVAL.

Example



Internationalization
Locales and Localization


iconv -- Convert Characters to New Code Set
iconv_close -- Remove Conversion Descriptor
setlocale -- Set Locale
<locale.h>