Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- int main()
- {
- ofstream out("output.txt", ios::binary);
- int n; cin >> n;
- for (int i = 1; i <= n; ++i)
- out.write((char*)&(i), sizeof(int));
- out.close();
- ifstream in("output.txt", ios::binary);
- while (in.peek() != EOF)
- {
- int cur;
- in.read((char*)&cur, sizeof(int));
- cout << cur << ' ';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement