Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename IterT>
- void WriteFile(std::wstring file,
- std::ios_base::openmode mode,
- IterT begin,
- IterT end)
- {
- std::copy(
- begin,
- end,
- std::ostreambuf_iterator<char>(std::ofstream(file, mode | std::ofstream::binary)));
- }
- template <typename IterT>
- void CreateFile(std::wstring file,
- IterT begin,
- IterT end)
- {
- WriteFile(file, std::ios_base::trunc, begin, end);
- }
- void CopyFile(std::wstring from,
- std::wstring to)
- {
- CreateFile(to,
- std::istreambuf_iterator<char>(std::ifstream(from, std::ios_base::binary)),
- std::istreambuf_iterator<char>());
- }
- std::vector<char> ReadFile(std::wstring file)
- {
- return std::vector<char>
- (
- std::istreambuf_iterator<char>(std::ifstream(file, std::ios_base::binary)),
- std::istreambuf_iterator<char>()
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement