I'm modifying parts of a larger codebase to remove some compiler warnings (in this case, -Wwrite-strings). A structure containing a char* is initialized with a string literal (const char*) and the compiler throws this warning. I searched a bit and found a few different solutions, however, I'd rather ask here first. I'm not going to change the structure itself, so I need to find the best way to cast in place.
From what I've read, the answer is probably const_cast<char*>(mystringliteral). The C way would be simply (char*).