c++ - How to get string from CP866 bytes -


my program read bytes file , try convert string. head of file text in cp866.

    iconv_t cd = iconv_open("utf-8","cp866");     char* iconv_in = bytes.data(); //bytes char vector     char* iconv_out = (char *)malloc(counter * sizeof(char)); //counter length of bytes array (char vector)     size_t iconv_in_bytes =counter;     size_t iconv_out_bytes = counter;      size_t ret = iconv(cd, &iconv_in, &iconv_in_bytes, &iconv_out, &iconv_out_bytes);      if ((size_t) -1 == ret) {             cout << "error convert";             return null;     } 

program ends failure (error convert). , way not simple , beautiful. there exist more simple solution?


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -