我将我的临时字符串打印到标准输出:
printf "%s", nodeToString(myNode)
但我想将此字符串打印到文件中。
我尝试了此处所述的解决方案,但 printf 结果仍会输出到标准输出。
编辑:澄清 cIph3r 的答案。
这是我在命令行上尝试的:
$ gdb
(gdb) attach 23053
(gdb) printf "%s", nodeToString(myNode) // This works and outputs to screen
(gdb) run printf "%s", nodeToString(myNode) > outputfile // I get this warning
The program being debugged has been started already.
Start it from the beginning? (y or n)