copy char pointer to string

I have
static char sID [10] = "888888";
static char pin[7] = "8888";
static std::string postData = "";
and In a function I want to pass the first string to postData
postData = "ayylmao";
then I want to merge the sID and pin to the string follow up by more strings

like postData = "ayylmao" + sID + "asdsd" + pin + "asdasd";
but I'm not sure how to do it. I was looking at strcpy and strcat, but there was some errors with it

The std::string constructor allows you to construct a std::string object from a C-string.
 
postData = std::string{ "ayylmao" } + std::string{ sID } + std::string{ "asdsd" } + std::string{ pin } + std::string{ "asdasd" };
Last edited on
thanks my dude, works perfectly
Topic archived. No new replies allowed.