How to concatenate a const char array and a char array pointer?

后端 未结 3 1255
梦谈多话
梦谈多话 2021-01-27 04:38

Straight into business: I have code looking roughly like this:

char* assemble(int param)
{
    char* result = \"Foo\" << doSomething(param) << \"bar\         


        
3条回答
  •  不要未来只要你来
    2021-01-27 04:56

    Well, you're using C++, so you should be using std::stringstream:

    std::string assemble(int param)
    {
        std::stringstream ss;
        ss << "Foo" << doSomething(param) << "bar";
        return ss.str();
    }; // eo assemble
    

提交回复
热议问题