How do I include extremely long literals in C++ source?

后端 未结 5 1773
陌清茗
陌清茗 2020-12-21 01:12

I\'ve got a bit of a problem. Essentially, I need to store a large list of whitelisted entries inside my program, and I\'d like to include such a list directly -- I don\'t w

5条回答
  •  囚心锁ツ
    2020-12-21 01:48

    I claim no credit for this one:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/c573db8b-c9cd-43d7-9f89-202ba9417296/fatal-error-c1091

    Use the STL instead.

    Code Snippet

    #include

    std::ostringstream oss;

    oss << myString1 << myString2 << myString3 << myString4;

    oss.str() would now return an instance of the STL's std:: string class, and oss.str().c_str() would return a const char*

提交回复
热议问题