Archived

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

std::string to char*?

This topic is 5581 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

Bah, I''ll just say it: how do you convert an std::string to a char*? I''ve tried some stuff which hasn''t worked, and I haven''t been using STL very long, and can''t seem to get past this. The thing that troubles me is that std::strings aren''t null-terminated?

Share this post


Link to post
Share on other sites
Sneftel: Thanks much.

I knew there would be a simple solution that I wasn''t familiar with. I would have found it eventually, except that the declaration for std::string is exceptionally long, even for an stl template, and I was getting brainfried trying to understand all of the functions from their names & return values. Should have gone to STL website; much better documentation than MSDN.

500 error

Share this post


Link to post
Share on other sites
yupyup... www.sgi.com/tech/stl is a URL every C++ programmer should know by heart.



Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites