为什么我的iconv出错
今天装了个libiconv-1.14.tar.gz
但运行iconv(cd,NULL,NULL,NULL,NULL);的时候, 总是报段错误 为什么呢?
int transcode(const char *from_code, const char *to_code, const char *src, int src_size, char* dest, int dest_size)
{
if (dest_size < src_size || dest_size <= 0 || src_size<=0)
return -1;
iconv_t cd;
cd = iconv_open(to_code, from_code);
iconv(cd,NULL,NULL,NULL,NULL);
cout<<"11111"<<endl;
while (i_size > 0)
{
}
iconv_close(cd);
return strlen(dest);
}
编译的时候 能编译过去, 就是运行的时候段错误, 有人知道为什么么?
[解决办法]
你看你给的要转码的编码名字的大小写 对这个是敏感的