problems converting string to char[]
Hello!
i searched the forum for string to char posts and tried a good one for converting a string to char[]:
Code:
string mystring = "that this and those";
char mychar[mystring.length()] = "";
for (int i=0; i < mystring.length(); i++)
mychar[i] = mystring[i];
cout << mychar;
It gives the right output but appends some weired output and i dont know how to fix it. I also tried to use:
Code:
for (int i = 0; i < mystring.length();++i )
But doesnt work either. There is still this weired appended output.
Thanks in advance!
~Jan