Jump to content
  • Advertisement

Archived

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

Emagen

vector<char> to char*

This topic is 6704 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there - Does anyone know how of an algorithm to convert a vector to a char*? Thanks all Emagen

Share this post


Link to post
Share on other sites
Advertisement
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
It messed up my code. That's supposed to be string [ i ] = v[ i ].


Mike

Edited by - Vetinari on 4/9/00 10:23:20 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!