#include <ostream> #include <istream> #include <fstream> namespace std { extern istream cin; extern ostream cout; // this is explained below static ios_base::Init __foo; // not its real name } using namespace std; main() { ofstream f ("toto.xyz", ios::out | ios::binary); int x[2] = {1,1}; int i; if(!f.is_open()) cout << "Impossible d'ouvrir le fichier en écriture !\n"; else { for (i = 0; i < 2; i++) f.write ((char *)&x[i], sizeof(int)); } cout << "bonjour !!"; f.close(); return 0; } |
00000001 00000001 |
00000011 |
|
|
|
|
namespace std { extern istream cin; extern ostream cout; // this is explained below static ios_base::Init __foo; // not its real name } |
|
|
|
|