3 ms·
string test=R"(C:\A\B\C\D\file1.txt)"; Hmm, that's ugly. Why are those parens needed?
by CamperBob2 13y ago
string test=R"(C:\A\B\C\D\file1.txt)";
Hmm, that's ugly. Why are those parens needed?
- vinkelhake 13y agoYou can prefix the left parenthesis with a string. You then repeat that string after the right parenthesis. By doing this you can include sequences in the raw string literal that would have otherwise terminated it. R"foo(xyz)")foo";
- bskari 13y agoThe parentheses are used as delimeters so that you can use quotes in the literal. string test = R"(the Star Trek catchphrase "Beam me up, Scotty" did not appear)"; If you want to use quotes in the string, you can add up to 16 chars to the delimiter, but you still have to use the parentheses. string test = R"[de=limiter!(the (Star Trek) catchphrase "Beam me up, Scotty" did not appear)[de=limiter!";