#include <iconv.h>
|
iconv_t
iconv_open (const char *tocode, const char *fromcode); Sh RETURN VALUES The iconv_open function returns a newly allocated conversion descriptor. In case of error, it sets errno and returns (iconv_t)(-1). |
If enough memory is not available in the system to create conversion descriptor, the iconv_open function sets errno.
The character sets permitted for fromcode and tocode are system dependent.
The allocated conversion descriptor can be used with iconv any number of times until it is deallocated using iconv_close.
#include<stdio.h> #include<iconv.h> int main() { iconv_t cd = NULL; //Allocate descriptor for charset conversion cd = iconv_open("UTF-8", "ISO-8859-1"); if(cd == (iconv_t) -1) { printf("Unbale to create a conversion descriptor0); } else { printf("Conversion descriptor is created successfully0); } iconv_close(cd); return 0; }
Output Conversion descriptor is created successfully
© 2005-2007 Nokia |