Problem with CString

May 27, 2013 at 3:05pm
i have a siily problem with CString ( MFC project in VC++6) . I don't understand why!!!
There is a line " CString line = _T("abc") " in my project, I think the value of line = "abc", but when debugging,in watch windown line = {a}.
Please tell me why? Thanks
May 27, 2013 at 3:22pm
It might that you're building a Unicode build but have not told the debugger to display unicode strings?

If so...

- use "Tools"\"Options" to open the Options dialog
- select the "Debugger" tab
- check the "Display unicode strings" checkbox

Andy

PS As a Unicode string looks like H\0e\0l\0l\0o\0 in memory, you can see how it would display if the debugger though the memory contained a char string!
Last edited on May 27, 2013 at 3:24pm
May 27, 2013 at 3:53pm
I have created a simple project to check, in watch windown line = {abc} . Then I check
the "Display unicode strings" checkbox but check box is not checked. So this is not involve in. But in my real project doesn't display line = {abc}.
May 27, 2013 at 8:50pm
To debug Unicode string you need to have the box checked (you said it was unchecked?)

Or you could (if possible) just recompile you app as Multi-Byte, which would just avoid the problem.

You are using _T(), etc throughout your code, yes?

Andy
Topic archived. No new replies allowed.