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

前端 未结 11 597
南方客
南方客 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 05:03

    In C/C++, the '\' character is reserved as the escape character. So whenever you want to actually print a '\', you must enter '\'. So to print the actual '\n' value you would print the following:

    printf("\\n");
    

提交回复
热议问题