Hi,
i using a IGUIEditBox and save the text written in there in a wchar_t variable.
but to send the name to a server i need a string variable.
I found no way to convert a wchar_t to a string.
is there any possiblillity?
How can i convert a wchar_t ?
There are many ways to represent strings (null-terminated c-strings with char*, with wchar_t*, irrlicht strings, stl strings, ...), so if you say "string" variable we don't really know what you mean. You have to know the type. But anyway, please always use the forum search before asking - this is a topic for which you will find a huge number of threads.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code: Select all
irr::core::stringw make_wide (const irr::core::string& s)
{
return irr::core::stringw (s);
}
irr::core::stringc make_narrow (const irr::core::stringw& w)
{
return irr::core::stringc (w);
}
std::stringw make_std (const irr::core::stringw& w)
{
return std::wstring (w.c_str(), w.size());
}
std::string make_std (const irr::core::stringc& s)
{
return std::string (s.c_str(), s.size());
}
irr::core::stringc make_irr (const std::string& s)
{
return irr::core::stringc (s.c_str(), s.size());
}
irr::core::stringw make_irr (const std::wstring& w)
{
return irr::core::stringw (w.c_str(), w.size());
}