liushijiu
liushijiu
2015-05-13 02:20
采纳率: 50%
浏览 3.7k

C++中有替代C#中@使字符串不转义的方法吗?

string path = @“C:\Program Files\DigiDNA\DiskAid”;
改成C++;

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

7条回答 默认 最新

  • oyljerry
    oyljerry 2015-05-13 02:48
    已采纳

    C++11支持raw string

     std::string path =  R"C:\Program Files\DigiDNA\DiskAid";
    
    点赞 评论
  • caozhy

    C++没有那么方便的功能,但是你可以使用一个肯定用不到的特殊字符代替\,然后一次性字符串替换

    点赞 1 评论
  • KnightMobile

    string path = “C:\Program Files\DigiDNA\DiskAid”;

    点赞 评论
  • KnightMobile

    string path = “C:\\Program Files\\DigiDNA\\DiskAid”;

    点赞 评论
  • VisualEleven
    Eleven 2015-05-13 10:29

    std::string path = "C:\Program Files\DigiDNA\DiskAid";

    点赞 评论
  • xy707707
    KrisRoofe 2015-05-21 07:23

    std::string path = R"C:\Program Files\DigiDNA\DiskAid";

    点赞 评论
  • jsyzjohntao
    老卤大头菜 2017-12-02 07:20

    std::string path = R"(C:\Program Files\DigiDNA\DiskAid)";

    点赞 评论

相关推荐