diff options
Rename static_struct_binary.cpp to simple_struct_binary.cpp
1 files changed, 0 insertions, 31 deletions
| -rw-r--r-- | Sem. 03/static_struct_binary.cpp | 31 |
diff --git a/Sem. 03/static_struct_binary.cpp b/Sem. 03/static_struct_binary.cpp deleted file mode 100644 index 6ee16de..0000000 --- a/Sem. 03/static_struct_binary.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include <iostream> -#include <fstream> -#pragma warning(disable:4996) -using namespace std; - - -struct Test -{ - bool b; - int x; -}; - -int main() -{ - - { //write - Test t = { true, 45 }; - ofstream file("testObj.bat", ios::binary); - - file.write((char*)&t, sizeof(t)); - } - - { //read - Test t; - ifstream file("testObj.bat", ios::binary); - - file.read((char*)&t, sizeof(t)); - std::cout << t.b << " " << t.x << std::endl; - } - -} |
