+ 1

String const-ness!!!!

The following code returns a const char*,is it possible to remove the cost-ness,can i use const cast in this case, the receiver could be a char[] or a normal char.. string word="Hello world"; someMethod(word.c_str());

25th Dec 2018, 7:20 AM
Mensch
Mensch - avatar
1 ответ
+ 1
You can copy the string into new array http://www.cplusplus.com/reference/cstring/strcpy/
25th Dec 2018, 7:44 AM
Taste
Taste - avatar