#include #include template typ1 readFromStream(std::ifstream &stream, char *dest) { if (stream.is_open()) { stream.read(dest, sizeof(char[1024])); typ1 *ptr = reinterpret_cast(dest); return std::move(*ptr); } else { std::runtime_error("Could not read from File!"); } } void Aufg9Main() { char *dest = new char[1024]; try { std::string fileName = "../Aufg9/IO-Files/charakter.d2s"; std::ifstream stream(fileName); auto header = readFromStream(stream, dest); printf("I read something!\n%X\n", header); for (int i = 0; i < 16; i++) { std::cout << dest[i] << std::endl; } long *test = reinterpret_cast(dest); printf("Test: %X\n", *test); } catch (const std::exception &e) { std::cout << e.what() << std::endl; } }