Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- struct test {
- int a;
- int b;//overall:8B
- };
- struct test2 {
- char ch;
- int num;//overall:8B
- };
- int main() {
- ofstream f("test.bat", ios::binary);
- test obj = { 3,4 };
- test2 obj = { 'a',4 };
- f.write((const char*)&obj, sizeof(test));
- f.write((const char*)&obj, sizeof(test2));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement