26 lines
444 B
C++
26 lines
444 B
C++
|
|
#include "common.hpp"
|
|
#include <string>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
using namespace std;
|
|
|
|
std::string ReadFile(const char* filename) {
|
|
string data("");
|
|
ifstream inputFile(filename);
|
|
if (inputFile.is_open())
|
|
{
|
|
string line;
|
|
while (getline(inputFile, line))
|
|
{
|
|
data.append(line);
|
|
// data.append("\r\n");
|
|
}
|
|
inputFile.close();
|
|
}
|
|
else
|
|
{
|
|
cerr << "Error: Unable to open file " << filename << endl;
|
|
}
|
|
return data;
|
|
} |