Syntax
#include <iconv.h> int iconv_close(iconv_t cd);Description
iconv_close deallocates the conversion descriptor cd and all other associated resources allocated by the iconv_open function.
If successful, iconv_close returns 0. Otherwise, iconv_close returns -1 is returned and sets errno to indicate the cause of the error. If cd is not a valid descriptor, an error occurs and iconv_close sets errno to EBADF.
This example shows how you would use iconv_close to remove a conversion descriptor.
#include <iconv.h>
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
const char fromcode[] = "IBM-850";
const char tocode[] = "IBM-863";
iconv_t cd;
if ((iconv_t)(-1) == (cd = iconv_open(tocode, fromcode))) {
printf("Failed to iconv_open %s to %s.\n", fromcode, tocode);
exit(EXIT_FAILURE);
}
if (-1 == iconv_close(cd)) {
printf("Fail to iconv_close.\n");
exit(EXIT_FAILURE);
}
return 0;
}
Related Information