Let's assume that I've got such a table:
char *table = "abcdef\n";
How can I put '\\n' as decimal subsituide (eg. in hex I put \\x0D, in oct I put \\015, but what about decimal?)
'/n'
is not a character control, but a multi-character constant, so I assume you're talking about '\\n'
instead.
There is no escape notation in decimal, so simply use \\n
, the octal ( \\012
or \\12
) or the hexadecimal ( \\x0a
) escape notation.
Or you can define one Macro #define NEW_LINE "\\n"
. then use char *table = "abcdef"NEW_LINE;
And if you cout <<table;
out put will be:
abcdef
_
It means the value of table is "abcdef\\n"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.