Кресты / Говнокод #13150 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
public ref class Form1 : public System::Windows::Forms::Form
{
private: char * StrToCharArray ( System::String ^ inStr )
{
    pin_ptr<const wchar_t> wch_basename = PtrToStringChars( inStr );
    size_t convertedChars = 0; size_t  sizeInBytes = ((inStr->Length + 1) * 2);
    char * ch_basename = (char *)malloc(sizeInBytes);
    wcstombs_s(&convertedChars, ch_basename, sizeInBytes, wch_basename, sizeInBytes);
 return ch_basename;
}
}

C++/CLI

Запостил: sokol sokol, (Updated )

Комментарии (1) RSS

  • Да и используется так:
    std::string s = StrToCharArray( ... );
    Ответить

Добавить комментарий

Из-за тебя ушел bormand, guest!

    А не использовать ли нам bbcode?


    8