Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <vector>
- #include <thread>
- #include <chrono>
- using namespace std;
- #pragma pack(push,1)
- struct long_struct {
- double data1[99999];
- long int data2[99999];
- long int data3[99999];
- };
- #pragma pack(pop)
- int main() {
- string name = "file.bin";
- ofstream out;
- out.open(name, ios::binary | ios::out | ios::trunc | ios::ate);
- out.clear();
- long_struct d1 = {};
- d1.data1[0] = 1;
- // long_struct d2 = {};
- // vector< long_struct> vec_tmp = { d1, d2 };
- char *a;
- long int size = 1000000000;
- a = new char[size];
- char end_char[10] { 'e', 'n', 'd', 'o', 'f', 'f', 'i', 'l', 'e' };
- chrono::steady_clock::time_point i = chrono::steady_clock::now();
- cout << "KILL NOW" << endl;
- out.write(reinterpret_cast<char *>(&d1), sizeof(d1));
- // this_thread::sleep_for(chrono::milliseconds(1000));
- out.write(a, size * sizeof(char));
- out.write(reinterpret_cast<char *>(&i), sizeof(i));
- out.write(end_char, 10 * sizeof(char));
- // out.write(reinterpret_cast<char *>(&data1), sizeof(data1));
- // out.write(reinterpret_cast<char *>(&data2), sizeof(data2));
- out.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement