Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <bitset>
- #include <vector>
- #include <string>
- #include <algorithm>
- using namespace std;
- int main(int argc, char *argv[]) {
- string filename = argv[1];
- fstream fs;
- string file = "/gpfs/home/VGabov/peresdacha1/";
- file+=filename;
- fs.open(file);
- // Чтение из файла в байтах
- char b;
- vector< bitset<8> > v;
- while (fs >> b) {
- v.push_back(bitset<8>(b));
- }
- // Реверс байтов
- reverse(begin(v), end(v));
- // Реверс имени
- reverse(begin(filename), end(filename));
- // Запить в файл
- ofstream out;
- out.open(filename);
- for(auto i : v) {
- out << i << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement