我写这个演示程序只是为了解释我的问题。它不会做任何有用的东西:如何在Visual Studio中的断点操作中打印长字符串?
#include <string>
int main(void)
{
std::string strMsg = "This is a very very long message, long enough that Visual Studio can't output it entirely. If you don't believe, just try it yourself and you'll see. What? I'm not long enough? Now it will be enough. You'll see ellipses at the end.";
return 0;
}
然后我在return 0;
添加一个破发点,用行动来打印strMsg
到输出窗口。
打印的字符串看起来像:
strMsg =“这是一个非常非常长的消息,足够长的时间的Visual Studio无法输出它完全如果你不相信。 ,只是自己尝试一下,你会看到什么?我不是足够长的时间呢?现在也就足够了。......
请注意...
在打印消息的结束,这是因为字符串太低完全打印。
有没有什么办法解决这个问题,所以Visual Studio可以打印整个字符串?
这可能不是你的真实情况下适合您的选项,而只是出于兴趣:会发生什么,如果您将字符串中的换行符? – Jeremy
@Jeremy你的意思是'\ n'?该字符将按原样打印,例如, ''abc \ n“'将被打印为'abc \ n'。 –