I have the following code:
glShaderSource(shader, 1, (const char **)data.c_str(), NULL);
But it makes my program crash. How do I convert std::string
into const char **
?
I also tried (const char **)&
but it said "requires l-value" which I don't understand. It works fine when I use this code:
const char *data = "some code";
glShaderSource(shader, 1, &data, NULL);
But I can't make it work directly from a std::string
. I could allocate a new char
array for it but that is not nice code.
I also tried with const GLchar
but obviously it makes no difference.