#include
#include
#include
main()
{
int cd;
unsigned char utf_8[10]="中";
unsigned char gb[10]={0};
unsigned char *pi1 = utf_8;
unsigned char **pi2 = &pi1;
unsigned char *po1 = gb;
unsigned char **po2 = &po1;
size_t ilen = 3;
size_t olen = 2;
iconv_t conveter;
if((conveter = iconv_open("gbk", "utf-8")) == (iconv_t)-1)
{
printf("iconv open fail \n");
return 1;
}
else
{
printf("iconv open ok \n");
}
iconv(conveter,(char**)pi2,&ilen,(char**)po2,&olen);
printf("\r\n utf_8[0] = %x \r\n",utf_8[0]);
printf("\r\n utf_8[1] = %x \r\n",utf_8[1]);
printf("\r\n utf_8[2] = %x \r\n",utf_8[2]);
printf("\r\n gb[0] = %x \r\n",gb[0]);
printf("\r\n gb[1] = %x \r\n",gb[1]);
}
阅读(16185) | 评论(0) | 转发(2) |