Code: Select all
char Name[] = "Node01";
IGUIEditBox* EditBox = addEditBox(...);
EditBox->setText(Name);
wchar_t* to char* conversion ? , how is done it ?
my english !!!
Code: Select all
char Name[] = "Node01";
IGUIEditBox* EditBox = addEditBox(...);
EditBox->setText(Name);
Code: Select all
core::stringw Name = "Node01";
EditBox->setText(Name.c_str());
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Code: Select all
char* Name = "NPC_Name";
int NameSize = strlen(Name);
wchar_t *Name_t = new wchar_t[NameSize+1]; // You have to create new wchar_t with size of Your char*
for (int i=0; i<=NameSize; i++)
{
if (Name[i] == 'ą') Name_t[i] = L'ą'; // for multibyte signs eg. Ą, Ź etc. You have to add multibyte support for Your project
Name_t[i] = Name[i]; // for all standard signs eg. A,B,c,d etc.
}
IGUIEditBox* EditBox = addEditBox(...);
EditBox->setText(Name_t);
delete[] Name_t; You have to free memory!
Code: Select all
// convert from char* to wchar_t*
mbstowcs(wchar_t*, const char*, size_t);
// convert from wchar_t* to char*
wcstombs(char*, const wchar_t*, size_t);
Yeah , works , thanks , now i have to change a lot of code , jeje ...Sylence wrote:you could forget the char[] and use irrlicht's string class instead.Code: Select all
core::stringw Name = "Node01"; EditBox->setText(Name.c_str());