SORU
26 AĞUSTOS 2008, Salı


Std dönüştürmek için nasıl::C LPCWSTR string (Unicode)

Bir yöntem arıyorum veya std dönüştürmek için bir kod parçacığını::string LPCWSTR

CEVAP
26 AĞUSTOS 2008, Salı


TechNet makalesine link için teşekkürler. Bu benim aradığım tam olarak ne olduğunu.

std::wstring s2ws(const std::string& s)
{
    int len;
    int slength = (int)s.length()   1;
    len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0); 
    wchar_t* buf = new wchar_t[len];
    MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
    std::wstring r(buf);
    delete[] buf;
    return r;
}

std::wstring stemp = s2ws(myString);
LPCWSTR result = stemp.c_str();

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Huot Media

    Huot Media

    7 Mayıs 2010
  • MusicDeluxeTV

    MusicDeluxeT

    14 Mayıs 2010
  • Tube Time

    Tube Time

    14 Mayıs 2013