1

I want to output a string like this: onclick="func()". So I wrote the following code:

  std::string s = R"(    
    onclick="func()"
    )";

But here two )" let the compiler confused.

Please forgive me if it's a silly question.

I googled but found nothing (I don't know which keyword I should use when I googled).

phuclv
  • 37,963
  • 15
  • 156
  • 475
alpha
  • 1,228
  • 1
  • 11
  • 26

1 Answers1

4

Simply add a unique string outside the ()

std::string s = R"anystring(    
  onclick="func()"
  )anystring";
phuclv
  • 37,963
  • 15
  • 156
  • 475