title: Getting garbage chars when reading GLSL files
body: <p>I run into the following problem.I load my shaders from files.The shader program ,when trying to compile, throws these errors for the vertex and fragment shaders:</p>
  
  <h2>Vertex info</h2>
  
  <p>0(12) : error C0000: syntax error, unexpected $undefined at token ""</p>
  
  <h2>Fragment info</h2>
  
  <p>0(10) : error C0000: syntax error, unexpected $undefined at token ""</p>
  
  <p>When inspecting the loaded content of the files I can see all kinds of garbage text is attached at the beginnings and the ends of the shader files.Like this one:</p>
  
  <pre><code>#version 330
  
  layout (location = 0) in vec4 position;
  layout (location = 1) in vec4 color;
  
  smooth out vec4 theColor;
  
  void main()
  {
  gl_Position = position;
  theColor = color;
  }ýýýý««««««««þîþîþîþ
  </code></pre>
  
  <p>The methods loading the shaders look as follows:</p>
  
  <pre><code>void ShaderLoader::loadShaders(char * vertexShaderFile,char *fragmentShaderFile){
  
  
  vs = loadFile(vertexShaderFile,vlen);
      fs = loadFile(fragmentShaderFile,flen);
  
  }
  char *ShaderLoader::loadFile(char *fname,GLint &amp;fSize){
  ifstream::pos_type size;
  char * memblock;
  string text;
  
  // file read based on example in cplusplus.com tutorial
  ifstream file (fname, ios::in|ios::binary|ios::ate);
  if (file.is_open())
  {
  size = file.tellg();
  fSize = (GLuint) size;
  memblock = new char [size];
  file.seekg (0, ios::beg);
  file.read (memblock, size);
  file.close();
  cout &lt;&lt; "file " &lt;&lt; fname &lt;&lt; " loaded" &lt;&lt; endl;
  text.assign(memblock);
  }
  else
  {
  cout &lt;&lt; "Unable to open file " &lt;&lt; fname &lt;&lt; endl;
  exit(1);
  }
  return memblock;
  }
  </code></pre>
  
  <p>I tried to change the encoding from UTF-8 top ANSI ,also tried to edit outside the visual studio but the problem still persists .Any help on this will be greatly appreciated.</p>