How to print '\n' instead of a newline?

前端 未结 11 605
南方客
南方客 2020-12-11 04:34

I am writing a program that uses prints a hex dump of its input. However, I\'m running into problems when newlines, tabs, etc are passed in and destroying my output formatti

11条回答
  •  北荒
    北荒 (楼主)
    2020-12-11 04:54

    You can escape the backslash to make it print just a normal backslash: "\\n".

    Edit: Yes you'll have to do some manual parsing. However the code to do so, would just be a search and replace.

提交回复
热议问题