I need to generate a UTF8 string to pass to a 3rd party library and I'm having trouble figuring out the right gymnastics... Also, to make matters worst, I'm stuck using C++ Builder 6 and every example I found talks about using std::string which CBuilder6 evidentially has no support for. I'd like to accomplish this without using STL what so ever.
Here is my code so far that I can't seem to make work.
wchar_t *SS1;
char *SS2;
SS1 = L"select * from mnemonics;";
int strsize = WideCharToMultiByte(CP_UTF8, 0, SS1, wcslen(SS1), NULL, 0, NULL, NULL);
SS2 = new char[strsize+1];
WideCharToMultiByte( CP_UTF8, 0, SS1, wcslen(SS1), SS2, strsize, NULL, NULL);
3rd party library chokes when I pass it SS2 as a parameter. Obviously, I'm on a Windows platform using Microsoft's WideCharToMultiByte but eventually I would like to not need this function call as this code must also be compiled on an embedded platform as well under Linux but I'll cross that bridge when I get to it.
For now, I just need to be able to either convert a wchar_t or char to UTF8 encoded string preferably without using any STL. I won't have STL on the embedded platform.
Thanks!