Visualisierung 2
Comparison of Hue Preserving Rendering to Alpha Composing
FileReader.cpp
Go to the documentation of this file.
1 
8 #include "FileReader.h"
9 
10 #include <fstream>
11 #include <sstream>
12 #include <iostream>
13 
14 std::string readFile(const std::string& filePath, size_t& error) {
15  std::stringstream content;
16 
17  std::ifstream file;
18  file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
19  try {
20  file.open(filePath);
21  content << file.rdbuf();
22  }
23  catch (std::ifstream::failure e) {
24  std::clog << "Unable to read file " + filePath << std::endl;
25  error = 1;
26  }
27 
28  return content.str();
29 }
std::string readFile(const std::string &filePath, size_t &error)
readFile reads the content of a file and returns it as string.
Definition: FileReader.cpp:14
File reader functionality.