- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 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;
}
}
sokol 11.06.2013 14:27 # +1
std::string s = StrToCharArray( ... );