Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert a char array to a string?

Status
Not open for further replies.

Flappy

Programmer
Jul 30, 2002
35
AU
I know I can use .c_str() to convert a string to a char array but what about the other way around?
 
Hello again Flappy, you don't need a special function because there's an overloaded assignment operator for char* types. eg: [tt]

char* str1 = "Hello World!";

string str2 = str1; // this is valid

[/tt]:)
tellis.gif

programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top