What datatype??
-
Chinese character is coming from "GetValue().bstrVal".. Take a look of following code..
bstrString_Dest = m_cpRecordsetSearch->Fields->GetItem("DestinationValue")->GetValue().bstrVal;
bstrString_Dest is declared as _bstr_t..
bstr_t bstrString_Dest
I tried with const whar_t *
const whar_t * bstrString_Dest
but no success.. My question is what data type should i use to hold chinese character in bstrString_Dest???? Thanks all..
-
Chinese character is coming from "GetValue().bstrVal".. Take a look of following code..
bstrString_Dest = m_cpRecordsetSearch->Fields->GetItem("DestinationValue")->GetValue().bstrVal;
bstrString_Dest is declared as _bstr_t..
bstr_t bstrString_Dest
I tried with const whar_t *
const whar_t * bstrString_Dest
but no success.. My question is what data type should i use to hold chinese character in bstrString_Dest???? Thanks all..
I'd highly recommend you read these two articles:
These should answer your question and will be invaluable for the future, however make sure to read part I first as part II relies on knowledge obtained there.
-
Chinese character is coming from "GetValue().bstrVal".. Take a look of following code..
bstrString_Dest = m_cpRecordsetSearch->Fields->GetItem("DestinationValue")->GetValue().bstrVal;
bstrString_Dest is declared as _bstr_t..
bstr_t bstrString_Dest
I tried with const whar_t *
const whar_t * bstrString_Dest
but no success.. My question is what data type should i use to hold chinese character in bstrString_Dest???? Thanks all..
A _bstr_t should certainly hold Chinese characters (it's effectively a managed wchar_t) - what's the problem that you're seeing?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
A _bstr_t should certainly hold Chinese characters (it's effectively a managed wchar_t) - what's the problem that you're seeing?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
_bstr_t did hold chinese character.. But when i see the data using watch or print to any file it shows "????" only... Chinese fonts are definately installed in my system..As i'm reading from database and i can vivdly see chinese character in database. Do i further need to typecast it?? Thanks..
-
_bstr_t did hold chinese character.. But when i see the data using watch or print to any file it shows "????" only... Chinese fonts are definately installed in my system..As i'm reading from database and i can vivdly see chinese character in database. Do i further need to typecast it?? Thanks..
How are you writing it to a file?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
How are you writing it to a file?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Now using this..
(char *)(wchar_t*)bstrString_Dest
-
Now using this..
(char *)(wchar_t*)bstrString_Dest
As I asked before, "How are you writing it to a file?"
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
As I asked before, "How are you writing it to a file?"
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
I'm writing in ini file..Also i'm displaying in messagebox..Say the data is "Abc(Some chinese character)"
MessageBoxW(0, (wchar_t*)bstrString_Dest, 0, 0);
The messagebox prints "Abc(square brackets)".
WritePrivateProfileString(pszSection,pszKey,(char *)(wchar_t*)bstrString_Dest,
pszinipath);And this prints "A" only...
-
I'm writing in ini file..Also i'm displaying in messagebox..Say the data is "Abc(Some chinese character)"
MessageBoxW(0, (wchar_t*)bstrString_Dest, 0, 0);
The messagebox prints "Abc(square brackets)".
WritePrivateProfileString(pszSection,pszKey,(char *)(wchar_t*)bstrString_Dest,
pszinipath);And this prints "A" only...
gothic_coder wrote:
The messagebox prints "Abc(square brackets)".
It's probably using non-Unicode font? The following code prints the expected ideaographs with Visual Studio 2008 and Windows 7
MessageBoxW(L"丁丂七", L"Test", MB_OK);
gothic_coder wrote:
WritePrivateProfileString(pszSection,pszKey,(char *)(wchar_t*)bstrString_Dest, pszinipath);
That's the ANSI call, so it's no surprise that you can't write Unicode successfully with that call. However, I don't think WritePrivateProfileString will write Unicode anyway.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
gothic_coder wrote:
The messagebox prints "Abc(square brackets)".
It's probably using non-Unicode font? The following code prints the expected ideaographs with Visual Studio 2008 and Windows 7
MessageBoxW(L"丁丂七", L"Test", MB_OK);
gothic_coder wrote:
WritePrivateProfileString(pszSection,pszKey,(char *)(wchar_t*)bstrString_Dest, pszinipath);
That's the ANSI call, so it's no surprise that you can't write Unicode successfully with that call. However, I don't think WritePrivateProfileString will write Unicode anyway.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Alright.. when i copy
MessageBoxW(L"丁丂七", L"Test", MB_OK);
It comes as
MessageBoxW(L"???", L"Test", MB_OK);
So it has something to do with my VC 6 setting..Isn't it.. Can someone throw light on it.. And please Stuart tell me how do i write the data on file (Notepad)??? Thanks
-
Alright.. when i copy
MessageBoxW(L"丁丂七", L"Test", MB_OK);
It comes as
MessageBoxW(L"???", L"Test", MB_OK);
So it has something to do with my VC 6 setting..Isn't it.. Can someone throw light on it.. And please Stuart tell me how do i write the data on file (Notepad)??? Thanks
Well
MessageBoxW(0, (wchar_t *)bstrString_Dest, 0, 0);
giving me right data... Now the problem is how do i print this data to file?? Notepad?? Thanks..