1
コンソールにWideStringを表示する際に問題があります。私はBuilder C++とC++で全く新しいです。デバッグが助けになるときに、私はいくつかのヘッダーが必要なのか、あるいは値が必要なのかはっきりしていません。WideString変数をコンソールに表示
wcout << s;
"wchar配列"の代わりにアドレスが表示されているようです。
ここでは、私のコードです:
//---------------------------------------------------------------------------
#include <iostream.h>
#include <vcl.h>
#include <string>
#include <wstring.h>
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
int a;
WideString s;
string str;
cout << "Enter a: ";
cin >> a;
//to read the return
cin.get();
cout << "Enter str: ";
cin >> str;
//to read the return
cin.get();
cout << "\n";
s = L"HELLO";
wcout << s;
cout << "\n\n";
wcout << L"BYE";
cout << "\n\nPress any key to continue...";
cin.get();
return 0;
}
//---------------------------------------------------------------------------
そして、それが出力されます。
Enter a: 4
Enter str: potato
2fb0b4
BYE
Press any key to continue...