|
楼主 |
发表于 2006-4-18 13:56:03
|
显示全部楼层
不知道怎么回事,老是出错,iconv函数返回,请问需要什么库和环境吗?
请看看我的函数
char* GbkToUtf8(char *_inStr)
{
size_t inLen,outLen;
char *_outStr = 0;
char **p = &_inStr;
iconv_t cd = iconv_open( "gb2312" , "utf-8" );
printf("GbkToUtf8:%d\n",cd);
inLen = strlen( _inStr ) ;
outLen = 128;
_outStr = malloc( outLen );
memset( _outStr , 0 , outLen );
if( iconv( cd , p , &inLen , &_outStr , &outLen ) == -1 )
printf("icon error\n");
else
printf( "%s\n" , _outStr );
return _outStr;
} |
|