#include using namespace std; int main(void) { ofstream out("myfile.txt", ios::trunc); //|ios::binary); int64_t n = 0xffeeddccbbaa0201; out.write(reinterpret_cast(&n), sizeof n) << "\n"; // char c[]="This is sample text."; // out.write(c, 4).write("!\n", 2); return 0; }