#include #include #include "fileDevice.h" #include fileDevice::fileDevice(std::string& filename): file(filename, std::ios::in | std::ios::out | std::ios::binary) { if (!file.is_open()) { throw std::runtime_error("Datoteke ni mogoče odpreti: " + filename); } } uint8_t fileDevice::read() { int c = file.get(); if (c == EOF) { return 0; } return static_cast(c); } void fileDevice::write(uint8_t val) { file.put(static_cast(val)); file.flush(); }