Converting a char array to something that can be a

2019-08-07 14:44发布

问题:

std::ostringstream parmStream;
char parmName[1024];
    THTTPUrl::Encode(parmName, pParm->Name().c_str(), 1024);

//I want to add the value of the paramName to the parmStream worked b4 when parmName was a string but obv not now

parmStream << "&" << parmName + "=";

Gives me the following .. error: invalid operands of types \u2018char [1024]\u2019 and \u2018const char [2]\u2019 to binary \u2018operator+\u2019

Cheers for the help in advance

回答1:

Try

parmStream << "&" << parmName << "=";

I haven't check your code but it looks like the error is pointing to the fact you are trying to add the "=" to a standard C string.