【Z一贴】Visual C++ Debugging: How to display UNICODE strings in Watch/QuickWatch window?

来源:互联网 发布:矩阵特征值的求法公式 编辑:程序博客网 时间:2024/06/08 19:12
Visual C++ Debugging: How to display UNICODE strings in Watch/QuickWatch window?

Q: I set a breakpoint in my source code to see the value of a string variable:





But in QuickWatch and Watch windows I see only the first character of string, like in images below:








What can I do to see the entire string contents?


A: Your build configuration is a UNICODE one, i.e. 'UNICODE' is added in 'Project Settings/C/C++/Preprocessor definitions'.

There are several solutions for the problem:

  • Append to the variable name 'su' formatting symbol in Watch/QuickWatch window.




  • Modify autoexp.dat file which is located in the same folder with msdev.exe.
    See the comments in autoexp.dat and Symbols for Watch Variables topic in MSDN


  • Last but not the least, go to Tools/Options/Debug and check 'Display Unicode strings'.