i need to convert UTF-8 file to unicode and display it on screen.
i know MultiByteToWideChar can do such conversion
lets say i write:
after the call num returns number of TCHAR that contained in buf variable.Code:CHAR buf[200]; int num=MultiByteToWideChar(CP_UTF8, 0, buf, sizeof(buf), NULL, 0);
now,
buf is 200 bytes long.
so it is possible that MultiByteToWideChar will not convert some of the last bytes of buf because they won't be a valid UTF-8 sequence
so my question is
how can i know the size of buf so it will fit exactly integral(whole) number of multi-byte characters?
thanks