Souldrift wrote:
char* text = new char[1024]; WCHAR w[1024]={0}; int erg=0;
Try to avoid using numbers directly or hard coding instead store in a constant.
const int SIZE = 1024; // Bytes
char* text = new char[SIZE];
WCHAR w[SIZE]={0};
erg=MultiByteToWideChar(CP_ACP, 0, text, -1, w, SIZE); // ANSI to UNICODE
erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, SIZE, 0, 0); // UNICODE to UTF-8
So when you change SIZE, this code still keeps working.
Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com