C++/String/string char array
Версия от 14:21, 25 мая 2010; (обсуждение)
Convert string to C-Style string
#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
int main()
{
string string1( "STRINGS" );
cout << "string string1 is " << string1
<< "\nstring1 converted to a C-Style string is "
<< string1.c_str() << "\n";
return 0;
}
/*
string string1 is STRINGS
string1 converted to a C-Style string is STRINGS
*/