This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename STD_COLLECTION> | |
std::string as_hex_string(STD_COLLECTION&& collection) { | |
std::stringstream ss; | |
for (unsigned char c: std::forward<STD_COLLECTION>(collection)) | |
ss << std::setfill('0') << std::setw(2) << std::hex << static_cast<short>(c) << " "; | |
return ss.str(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string file_as_string(const string& path) { | |
auto ss = ostringstream{}; | |
ifstream input_file(path); | |
if (!input_file.is_open()) { | |
cerr << "[ERROR] could not open file ‘" << path << "‘.n"; | |
exit(EXIT_FAILURE); | |
} | |
ss << input_file.rdbuf(); | |
return ss.str(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() { | |
std::cout << "Hello, World!" << std::endl; | |
return 0; | |
} |