mirror of
https://github.com/kuhyx/engineer-thesis-WUT.git
synced 2026-07-04 17:43:01 +02:00
26 lines
636 B
C++
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 |