简体   繁体   English

在Visual Studio 2008中显示CR / LF的Visual C ++调试窗口

[英]Visual C++ Debug window displaying of CR/LF in Visual Studio 2008

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. 一段时间以来,当我调试Visual C ++应用程序并在Local,Auto或Watch调试窗口中查看任何CString或char *(或任何其他基于ascii char的类型)变量时,我的变量中的CR / LF字符不会显示一点都不

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". 换句话说,如果我的代码中有一个字符串变量设置为“这是一行\\ r \\ n这是另一行”,调试窗口将显示“这是一行,这是另一行”。 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. 此外,我的一些同事能够以正确的方式看到CR / LF字符,但我们无法确定为什么不为我显示它们。

Many thanks in advance. 提前谢谢了。

This seems to be some sort of hard-to-reproduce bug (I'm not seeing them in 2k8 either) according to this old link : 根据这个旧的链接,这似乎是某种难以重现的错误(我也没有在2k8中看到它们):

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. 例如,在字符串中显示“\\ r \\ n”。 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. 如果您正在查看带有换行符的文本,则可以将该字符串视为字符数组:键入“str,100”以查看长度为100的字符串作为数组。 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. 我们无法在VS2003和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. 因此,如果你的同事真的看到它,那么我们的设置中肯定会有一些奇怪的事情发生。

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. 不确定这是不是你的问题,但要检查一下。

为了回应我至少在2008年发现的SQL Server问题,如果你得到200行进行编辑,它将显示\\ r \\ n方块,如果你得到1000行只读它不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM