Question

For some time now when I am debugging Visual C++ applications and viewing any CString or char* (or any other ascii char based type) variable in the Local, Auto, or Watch debug windows, the CR/LF characters in my variables are not displayed at all.

In other words, if I have a string variable set to "This is a line\r\nThis is another line" in my code, the debug window will show "This is a lineThis is another line". What I would like it to show is "This is a line□□This is another line" so that I can see the two extra characters in that text.

This has caused me to make some mistakes when trying to debug string parsing code. Note, the text visualizer properly breaks the text up into separate lines, but I don't want to use the text visualizer if I don't have to. Furthermore, some coworkers of mine are able to see CR/LF characters in the correct manner, but we cannot determine why they are not shown for me.

Many thanks in advance.

Was it helpful?

Solution

This seems to be some sort of hard-to-reproduce bug (I'm not seeing them in 2k8 either) according to this old link:

If we wanted to do this properly we'd need to issue the proper escape sequences for these characters. eg show "\r\n" in the string. The behavior of stripping special characters historical and will be fixed in a future release. If you are viewing text with newlines in it you can either view the string as a character array: type "str,100" to view a string of length 100 as an array. Or you can click on the magnifying glass glyph and view the string in a multiline edit control.

A month later:

We cannot reproduce this problem on neither VS2003 nor VS2005. This looks like a machine-specific problem.

So if your coworkers are really seeing it then there must be something weird going on in our setups.

OTHER TIPS

Could it be the font you are using? are you all using the same (preferably default) font?

I've had a number of pesky issues come up with people doing that. Not sure if that is your problem, but its something to check.

In response to the SQL Server question I've found, in 2008 at least, that if you get the 200 rows for edit it will show the \r\n squares, if you get the 1000 rows for readonly it will not.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top