Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Util.cpp
Go to the documentation of this file.
1 #include "Util.hpp"
2 
3 string Util::read_file_to_string(string const & filename)
4 {
5  ifstream shaderFile(filename);
6 
7  if (shaderFile.good())
8  {
9  string result = string(istreambuf_iterator<char>(shaderFile),
10  istreambuf_iterator<char>());
11  shaderFile.close();
12 
13  return result;
14  }
15  else
16  {
17  cerr << "ERROR: Could not load file '" << filename << "'" << endl;
18  exit(EXIT_FAILURE);
19  }
20 }
string read_file_to_string(string const &filename)
Definition: Util.cpp:3