3

When I want to write a literal string in Python, I use r before the string (or @ in C#):

in [1]: print r'\no esca\pe ch\ara\cters'
out [1]: \no esca\pe ch\ara\cters

In straight c++ I can use R, but in the Arduino IDE, this throws the following error:

Serial.begin(9600);
Serial.println(R"\no esca\pe ch\ara\cters");
<output> invalid character '\'in raw string delimiter

So how do I do the same in Arduino c++?

asked Aug 1, 2016 at 16:34

1 Answer 1

3

Raw strings in C++11 must have parens within the quotes in order to allow for a custom delimiter. Since your string lacks those parens, it is not valid.

Serial.println(R"(\no esca\pe ch\ara\cters)");
answered Aug 1, 2016 at 16:59

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.