2022-09-05 20:17:25 +02:00
|
|
|
#ifndef MISC_CPP
|
|
|
|
|
#define MISC_CPP
|
|
|
|
|
#include <iostream>
|
2022-09-18 18:10:03 +02:00
|
|
|
#include <fstream>
|
|
|
|
|
#include <sstream>
|
2022-09-05 20:17:25 +02:00
|
|
|
#include "misc.hpp"
|
|
|
|
|
void print(const std::string s)
|
|
|
|
|
{
|
|
|
|
|
std::cout << s << std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-18 18:10:03 +02:00
|
|
|
std::string fileBufferToString(const std::string filePath, std::ifstream &file)
|
|
|
|
|
{
|
|
|
|
|
std::string sourceCode;
|
|
|
|
|
// open files
|
|
|
|
|
file.open(filePath); // read file's buffer contents into streams
|
|
|
|
|
std::stringstream fileStream;
|
|
|
|
|
fileStream << file.rdbuf();
|
|
|
|
|
// close file handlers
|
|
|
|
|
file.close();
|
|
|
|
|
// convert stream into string
|
|
|
|
|
sourceCode = fileStream.str();
|
|
|
|
|
return sourceCode;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-05 20:17:25 +02:00
|
|
|
#endif
|