you can simply acces every char in a string by saying mystring[2] returns the third character in your string, so it's quite easy to build your own array.
You can use mystring.c_str() to create an array of chars, but it will have added a null character to the end.
* Ah...too slow.
I'm not entirely sure what you want here, but std::string has a member method that retrieves the internal C-String representation of itself.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <string>
int main(void)
{
std::string str = "What are you doing with my CString???";
constchar* pointer = str.c_str();
std::cout << "std::string: " << str << std::endl;
std::cout << "const char*: " << pointer << std::endl;
return 0;
}
no no no no, i have an array of 70 members, but iwant to but an entire string int one array member. lets say strign si 42,657,435,754,456 and i want ot put it in x[0] then x[1] will be new strign and so on and so on.
im only gettign conversion errors here. x[i] = total - cant conver int_64 to char possible loss of data and in the end x[d] << outdoes not allow. so what ot do to fix these problems.
Well, that's because x is a string array and total is an integer...you have to convert the number to a string, and refer to a specific element of the array.