Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <fstream>
- #include <string>
- #include <vector>
- using namespace std;
- int main()
- {
- ifstream ifd("C:\Users\", ios::binary | ios::ate);
- int size = ifd.tellg();
- ifd.seekg(0, ios::beg);
- vector<char> buffer;
- buffer.resize(size);
- ifd.read(buffer.data(), size);
- const int N = 16;
- const char hex[] = "0123456789ABCDEF";
- char buf[N*4+5+2];
- for (int i = 0; i < buffer.size(); ++i)
- {
- int n = i % N;
- if (n == 0)
- {
- if (i)
- puts(buf);
- memset(buf, 0x20, sizeof(buf));
- buf[sizeof(buf) - 2] = 'n';
- buf[sizeof(buf) - 1] = '