Skip to main content
added 84 characters in body
Source Link
user963241
  • 7.1k
  • 21
  • 70
  • 102

I'm kind of new to using Unicode string and pointers and I've no idea how the conversion to unicode to ascii and versa-versa works. Following is what I'm trying to do,

const wchar_t *p = L"This is a string"; 

If I wanted to convert it to char*, how would the conversion work with converting wchar_t* to char* and vice-versa?

or by value using wstring to string class object and vice-versa

std::wstring wstr = L"This is a string"; 

If i'm correct, can you just copy the string to a new buffer without conversion?

I'm kind of new to using Unicode string and pointers and I've no idea how the conversion to unicode to ascii and versa-versa works. Following is what I'm trying to do,

const wchar_t *p = L"This is a string"; 

If I wanted to convert it to char*, how would the conversion work with converting wchar_t* to char* and vice-versa?

or by value using wstring to string class object and vice-versa

std::wstring wstr = L"This is a string"; 

I'm kind of new to using Unicode string and pointers and I've no idea how the conversion to unicode to ascii and versa-versa works. Following is what I'm trying to do,

const wchar_t *p = L"This is a string"; 

If I wanted to convert it to char*, how would the conversion work with converting wchar_t* to char* and vice-versa?

or by value using wstring to string class object and vice-versa

std::wstring wstr = L"This is a string"; 

If i'm correct, can you just copy the string to a new buffer without conversion?

Source Link
user963241
  • 7.1k
  • 21
  • 70
  • 102

Converting unicode strings and vice-versa

I'm kind of new to using Unicode string and pointers and I've no idea how the conversion to unicode to ascii and versa-versa works. Following is what I'm trying to do,

const wchar_t *p = L"This is a string"; 

If I wanted to convert it to char*, how would the conversion work with converting wchar_t* to char* and vice-versa?

or by value using wstring to string class object and vice-versa

std::wstring wstr = L"This is a string";