Historique des modifications - Message

Message #238

Sujet: C++ Irrlicht 1.1 : conversions std::string et stringw


Type Date Auteur Contenu
Création du message 22-10-2006 11:49:42 Aranoth
De std::string à stringw :

Code c++ :

irr::core::stringw getStringw(std::string str)
{
  size_t size = str.size();
  wchar_t *text = new wchar_t[size+sizeof(wchar_t)]; //s.size() doesn't include NULL terminator
  const char *data = &str[0];

  mbsrtowcs(text, &data, size, NULL);

  text[size] = L'\\0';
  return text;
}

et l'inverse :

Code c++ :

std::string getStringSTL(irr::core::stringw str)
{
  std::string text = stringc(str.c_str()).c_str();
  return text;
}

Retour

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
148 invités en ligne
membre en ligne: -
RSS Feed