When i create std::string and define it in program like this and print it to console it looks like this:
std::string shader = "#version 330\nlayout(location = 0) in vec3 vp;void main(){gl_Position = vec4(vp, 1.0);}";
printf("Original: %s\n", shader.c_str());
But when i load std::string from file the way below and then print it to console it looks like this:
std::string shader;
std::ifstream inputStream(path, std::ifstream::in);
if (inputStream.is_open())
{
while (inputStream.good())
{
std::string line;
getline(inputStream, line);
shader.append(line);
}
}
printf("LOADED: %s\n", shader.c_str());
Text file:
#version 330\n
layout(location=0) in vec3 vp;
void main ()
{
gl_Position = vec4 (vp, 1.0);
}
I need it do be same when loading from file. To be more specific i need it to use the special character \n.
The problem here is that i need new line between "..330" and "layout..."