c_str() はread-onlyやねん
I got stuck and very frastrated why the folloing error is thrown,
cannot convert parameter 1 from 'const char *' to 'char *'
when I execute
cp = strtok_s(str, delimiter.c_str(), &cpx);
answer is that c_str() returns const char*,
read only. while strtok is try to write interanlly,,,.
my conclusion is do not use strtok for string!!
thanks, stackoverflow
http://stackoverflow.com/questions/8713992/how-convert-type-from-const-char-to-char
You can't just "convert it" and forget about it. The pointer you get from .c_str() is to a read-only buffer. You need to copy it into a new buffer to work with: ideally, by avoiding using antiquated functions like strtok in the first place.