engineer-thesis-WUT/Engine/engine/misc.cpp

26 lines
636 B
C++

#ifndef MISC_CPP
#define MISC_CPP
#include <iostream>
#include <fstream>
#include <sstream>
#include "misc.hpp"
void print(const std::string s)
{
std::cout << s << std::endl;
}
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;
}
#endif