2

我有

std::string str = "hello world";
std::wstring wstr = L"goodbye world";
std::cout << str << std::endl;
std::wcout << wstr << std::endl;

当我开始调试并在 VS 6.0 的调试器“自动”窗口的第三行设置断点时,我得到:

std::cout   {...}
str {0x001f2de1 "hello world"}
wstr    {0x001f2e4a}

而且我看不到 wstr 值...

我如何配置 VS 才能做到这一点?

谢谢

4

2 回答 2

5

这句话来自 VisualStudio 6.0 autoexp.dat:

------- 统一码 -------

如果您的应用程序是为 Unicode 构建的,您将希望 Unicode
字符串自动扩展为文本,而不是
无符号短数组。要自动将 Unicode 字符串显示为文本,请转到工具/选项/调试选项卡并选中“显示 Unicode 字符串”。

因此,在您的 VisualStudio 6.0 中,您应该转到Tools/Options/Debug打开 "Display Unicode strings"

之后你会看到:

  • std::cout {...}
  • str {0x00441d21“你好世界”}
  • wstr {0x00441cb2“再见世界”}
于 2012-02-03T12:08:25.893 回答
0

添加手表:

str._Bx._Ptr

如果字符串少于 16 个字符,那么我们应该注意

str._Bx._Buf

于 2012-02-03T11:19:20.530 回答