Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <fstream>
- #include <string>
- void CreateFile(const std::string& path) noexcept {
- std::ofstream file(path, std::ios_base::app);
- file.close();
- }
- bool ShifrFile(const std::string& path,
- uint8_t(*const ShifrFunc)(const uint8_t)) noexcept {
- std::fstream file(path, std::ios_base::binary
- | std::ios_base::in | std::ios_base::out);
- if (!file.is_open()) return false;
- for (size_t i = 0; file; ++i)
- {
- uint8_t v = ShifrFunc(file.seekg(i).get());
- file.seekp(i).put(v);
- }
- file.close();
- return true;
- }
Add Comment
Please, Sign In to add comment