I like using STL basic::string but sometimes I need to use a char * or a
standard c char array. I s there a way to convert convert a basic::string
into a char * or char ?
Do you mean string?
To get a c type string from the string class, use the c_str() member function.
Dan Nguyen | It is with true love as it is with ghosts;
25 2F 99 19 6C C9 19 D6 1B 9F F1 E0 E9 10 4C 16
cStr= new char[myString.size()] + 1; // string::size() doesn't report the
delete  cStr; // use array form of delete with array form of new
>>I like using STL basic::string but sometimes I need to use a char * or a
>>standard c char array. I s there a way to convert convert a basic::string
>>into a char * or char ?
Basically I want to write a function like:
using namespace std;
void dump(const string& from_string, string& to_string)
// convert all characters from the string from_string to a
// hex representation of those characters, separated by space.
// so if from_string = "Hello"
// the to_string should be = "48 65 6c 6c 6f"
I cannot think of any way using STL to achieve this. The only thing
that comes to mind is to use sprintf( %02x ).....kind of C-like code.