如何使用换行符打印以空字符结尾的字符串而不在 gdb 中显示反斜杠转义? [英] How to print a null-terminated string with newlines without showing backslash escapes in gdb?
本文介绍了如何使用换行符打印以空字符结尾的字符串而不在 gdb 中显示反斜杠转义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个变量
char* x = "asd
qwe
... "
我想用换行符打印它而不是反斜杠n.有可能吗?
and I want to print it with newlines printed as newlines not backslash n. Is it possible?
推荐答案
更新:为什么不直接使用 gdb printf
命令?
Update:
Why not just use the gdb printf
command?
(gdb) printf "%s", x
asd
qwe
...
(gdb)
<小时>
旧答案:在调试器中,您可以执行命令.只需调用 printf
(gdb) call printf("%s", x)
asd
qwe
...
(gdb)
这篇关于如何使用换行符打印以空字符结尾的字符串而不在 gdb 中显示反斜杠转义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文