wchar_t* wsz = L .. proplem ..
-
Hi... I wrote the following function code to perform Unicode conversion ,it works fine when I specify the string I want to convert as it shows but if I need to make it a variable ,it gives me error: ---------------------------------------------------------- void CTestDlg::OnCobe(CString x) { wchar_t* wsz = L"ABC"; // wchar_t* wsz = L x; --> This is give me an error CString c,cc,x; cc=""; for (int i=0;i <9 ;i++) { c.Format("%04X",wsz[i]); if (c == "0020") c=" "; cc=cc+c; } MessageBox(cc); } ---------------------------------------------- I tried to wrote in different way but each time I get the same error ,I searched on the internet almost all ensamples uses this form " " ... if anyone know how to do that I will be very grateful ...
-
Hi... I wrote the following function code to perform Unicode conversion ,it works fine when I specify the string I want to convert as it shows but if I need to make it a variable ,it gives me error: ---------------------------------------------------------- void CTestDlg::OnCobe(CString x) { wchar_t* wsz = L"ABC"; // wchar_t* wsz = L x; --> This is give me an error CString c,cc,x; cc=""; for (int i=0;i <9 ;i++) { c.Format("%04X",wsz[i]); if (c == "0020") c=" "; cc=cc+c; } MessageBox(cc); } ---------------------------------------------- I tried to wrote in different way but each time I get the same error ,I searched on the internet almost all ensamples uses this form " " ... if anyone know how to do that I will be very grateful ...
Try this
USES_CONVERSION; CString strTTT; wchar_t *llp = T2W(strTTT);
Sonork 100.41263:Anthony_Yio Life is about experiencing ... -
Hi... I wrote the following function code to perform Unicode conversion ,it works fine when I specify the string I want to convert as it shows but if I need to make it a variable ,it gives me error: ---------------------------------------------------------- void CTestDlg::OnCobe(CString x) { wchar_t* wsz = L"ABC"; // wchar_t* wsz = L x; --> This is give me an error CString c,cc,x; cc=""; for (int i=0;i <9 ;i++) { c.Format("%04X",wsz[i]); if (c == "0020") c=" "; cc=cc+c; } MessageBox(cc); } ---------------------------------------------- I tried to wrote in different way but each time I get the same error ,I searched on the internet almost all ensamples uses this form " " ... if anyone know how to do that I will be very grateful ...
If you define _UNICODE the internal CString buffer is already unicode data, which you can get using GetBuffer(). If _UNICODE is not defined, you can convert the buffer using MultiByteToWideChar. Hope this helps! Due Regards Mahendra
-
Try this
USES_CONVERSION; CString strTTT; wchar_t *llp = T2W(strTTT);
Sonork 100.41263:Anthony_Yio Life is about experiencing ... -
You will need #include "atlconv.h" Sonork 100.41263:Anthony_Yio Life is about experiencing ...
-
Hi... I wrote the following function code to perform Unicode conversion ,it works fine when I specify the string I want to convert as it shows but if I need to make it a variable ,it gives me error: ---------------------------------------------------------- void CTestDlg::OnCobe(CString x) { wchar_t* wsz = L"ABC"; // wchar_t* wsz = L x; --> This is give me an error CString c,cc,x; cc=""; for (int i=0;i <9 ;i++) { c.Format("%04X",wsz[i]); if (c == "0020") c=" "; cc=cc+c; } MessageBox(cc); } ---------------------------------------------- I tried to wrote in different way but each time I get the same error ,I searched on the internet almost all ensamples uses this form " " ... if anyone know how to do that I will be very grateful ...
The
L
prefix is only legal before a string or character literal, nothing else. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Laugh it up, fuzzball. -
The
L
prefix is only legal before a string or character literal, nothing else. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Laugh it up, fuzzball. -
You will need #include "atlconv.h" Sonork 100.41263:Anthony_Yio Life is about experiencing ...