Cyber Security Kangceptautomation.blog.chinaunix.net
kxj99
malware/APT detection, silicon valley, entrepreneur, CTO, start-up operation, team build, Nanjing/Beijing, if you want to do creative things, join the adventure.
全部博文(47)
分类: C/C++
2008-05-01 06:43:37
#include "string.h" #include <iostream> #include <fstream> using namespace std; int main(int argc, char** argv){ int n[] = {1,2,3,4,5}; ofstream out("test.txt", ios::out | ios::binary | ios::trunc); if(! out){ cout << "cannot open out\n";return 1; } out.write((char*)&n, sizeof n); out.close(); for(int i=0; i<5; i++){ n[i] = 0; } ifstream in("test.txt", ios::in | ios::binary); if(! in){ cout << "cannot open in\n";return 1; } in.read((char*) &n, sizeof n); for(i=0; i<5; i++){ cout << n[i] << endl; } in.close(); return 0; }
上一篇:reverse string and sentence
下一篇:Exception
登录 注册