char в wchar_t
char *Inp = "Hello, World!";
size_t origsize = strlen(inp) + 1;
const size_t newsize = 100;
size_t i = 0;
wchar_t Out[newsize];
mbstowcs_s(&i, Out, origsize, Inp, _TRUNCATE);
string в wchar_t
string Inp = "Hello, World!";
const size_t newsize = 100;
size_t Inp_size = strlen(Inp.c_str()) + 1;
size_t i = 0;
wchar_t Out[newsize];
mbstowcs_s(&i, Out, Inp_size, Inp.c_str(), _TRUNCATE);
String в wchar_t
#include "vcclr.h"
#include "stdlib.h"
using namespace std;
String ^Inp = gsnew String("Hello, World!");
pin_ptr<const wchar_t> wch = PtrToStringChars(Inp);
const size_t newsize = 100;
wchar_t Out[newsize];
wcscpy_s(Out, wch);
|