I am using shaders in a C++/OpenGL program and am trying to cout any errors I get in the code using a char array. All that comes out though is unintelligible garbage.

unsigned int shader::loadshader(std::string& source, unsigned int mode)
unsigned int id;

const char* csource=source.c_str();

glShaderSource(id, 1, &csource, NULL);
char error[1000];
glGetShaderInfoLog(id, 1000, NULL, error);
std::cout << "compile stat: \n" << error << std::endl;
return id;

What comes out is this: