String literals C++?

后端 未结 4 383
误落风尘
误落风尘 2020-12-10 13:08

I need to do the following C# code in C++ (if possible). I have to const a long string with lots of freaking quotes and other stuff in it.

const String _lit         


        
4条回答
  •  自闭症患者
    2020-12-10 13:17

    There is no raw string literals in C++. You'll need to escape your string literals.

    std::string str = "I can use \"quotes\" inside here";
    

    C++0x offers a raw string literal when it's available:

    R"C:\mypath"
    

    By the way you should not name anything with a leading underscore as such identifiers are reserved in C++.

提交回复
热议问题