When I want to special characters in a string I should use "\":
std::string text("item \t new_item\n")
But, if I print this string, obviously, it will print:
item new_item
Is there a way set std::cout to print all special characters:
item \t new_item \n
\t and \n will print a tab(4 white spaces) and a new line respectively.
If you want to print \t and \n as output. You have to add an extra \ as prefix before \t and \n.
std::string text("item \\t new_item \\n")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With