Не могу разобраться в чем причина, код
char * CodeCharSet(char* in, const char* in_set, const char* out_set)
{
iconv_t cd;
size_t in_l = strlen(in), k;
size_t out_l = in_l*2;
char* out_buff = (char*)malloc(out_l*sizeof(char));
char* out = out_buff;
memset(out, 0, out_l);
cd = iconv_open(out_set, in_set);
if (cd != (iconv_t)-1)
{
iconv(cd, &in, &in_l, &out, &out_l);
iconv_close(cd);
}
else memcpy(out_buff,in,in_l);
return out_buff;
}
char buf[256] = "БЛАБЛАБЛА";
cout << buf << endl;
CodeCharSet(buf, "UTF-8", "WINDOWS-1251");
cout << buf << endl;