Alex Rivera | Logout

How do I convert a string to a char* in c++?

Asked 2010-11-11T18:00:44.993
22

I have an error in my program: "could not convert from string to char*". How do I perform this conversion?

Edit
Report

1 Answer

3

Use the c_str() method on a string object to get a const char* pointer. Warning: The returned pointer is no longer valid if the string object is modified or destroyed.

answered 2010-11-11T18:03:27.150

Your Answer