tags:

views:

409

answers:

1

I have a variable

char* x = "asd\nqwe\n ... "

and I want to print it with newlines printed as newlines not backslash n. Is it possible?

+6  A: 

From within the debugger you can execute commands. Just call printf

(gdb) call printf("%s", x)
asd
qwe
...
(gdb)

Update: Rather than calling printf, why not just use the gdb printf command?

(gdb) printf "%s", x
asd
qwe
...
(gdb)
ezpz
I can't use stdout or stderr because these channels are attached to other program.
Łukasz Lew
Splendid. Thanks.
Łukasz Lew