Archived

This topic is now archived and is closed to further replies.

Emagen

vector<char> to char*

Recommended Posts

That doesn''t seem to work because it can''t convert a char to char*.

I need to append char to a char*, so I need to concatenate char to a char*.

Any ideas anyone?

thanks
Emagen

Share this post


Link to post
Share on other sites
First, I question the wisdom of using a vector. You seem to be wanting to have an array of characters, and you could do so with std::string.

As for the answer, you can try the copy algorithm
vector V(5);
char strArray[5];
copy(V.begin(), V.end(), strArray);
where the first parameter is source begin, followed by source end, and then strArray.

Please elaborate more as I do not really get what you need

Share this post


Link to post
Share on other sites