string Program::get_info_log() const
{
GLsizei len = get_program_i(id, GL_INFO_LOG_LENGTH);
- char *buf = new char[len+1];
- glGetProgramInfoLog(id, len+1, &len, buf);
- string log(buf, len);
- delete[] buf;
+ string log(len+1, 0);
+ glGetProgramInfoLog(id, len+1, &len, &log[0]);
+ log.erase(len);
return log;
}
string Shader::get_info_log() const
{
GLsizei len = get_shader_i(id, GL_INFO_LOG_LENGTH);
- char *buf = new char[len+1];
- glGetShaderInfoLog(id, len+1, &len, buf);
- string log(buf, len);
- delete[] buf;
+ string log(len+1, 0);
+ glGetShaderInfoLog(id, len+1, &len, &log[0]);
+ log.erase(len);
return log;
}