Hello!
When I try to add ASCII art, some parts of it are red and the image is not displaying correctly, why and how to fix that?
Thanks!
Hello!
When I try to add ASCII art, some parts of it are red and the image is not displaying correctly, why and how to fix that?
Thanks!
It’s because your ASCII creates an escape sequence from backslashes. More on that in lesson 25. Functions (1:35)
\
is the start of an escape sequence like \n
. So in order to get \
you need \\
(similarly to get "\n"
you would need "\\n"
)
You could instead use a “raw string literal” which will treat your text as is so if you have “\n” it’ll interpret that as "\\n"
and not a newline, to get a newline you would just put a newline.
A raw string literal has the syntax R"(text here)"
e.g.
R"(This
is
a
raw
string
literal)"
Would be interpreted as "This\nis\na\nraw\nstring\nliteral"
Thank you!
Thank you sir!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.