JadeMason
JadeMason

Reputation: 1191

How to view the value of a unicode CString in VC6?

I'm using Visual Studio 6 to debug a C++ application. The application is compiled for unicode string support. The CString type is used for manipulating strings. When I am using the debugger, the watch window will display the first character of the string, but will not display the full string. I tried using XDebug, but this tool does not handle unicode strings properly. As a work around, I can create a custom watch for each character of the string by indexing into the private array the CString maintains, but this is very tedious.

How can I view the full, unicode value of a CString in the VC6 debugger?

Upvotes: 3

Views: 2838

Answers (1)

Eran
Eran

Reputation: 22020

Go to tools->options->Debug, and check the "Display unicode string" check-box. That would probably fix the problem. Two other options:

  1. In the watch window, if you have a Unicode string variable named szText, add it to the watch as szText,su. This will tell VS to interpret it as a Unicode string (See Symbols for Watch Variables for more of this sort).
  2. Worst comes to worst, you can have a global ANSI string buffer, and a global function that will get a Unicode CString and store its content as ANSI, in that global variable. Then, when need call that function with the string whose content you'd like to see in the watch window, and watch the ANSI buffer.

But the "Display unicode string" thing is probably the problem...

Upvotes: 8

Related Questions