#include <iostream> #include <fstream> using namespace std; int main() { ofstream out("f.bin"); char c = 0x61; out.write(&c, sizeof(char)); ifstream in("f.bin"); char d; in.read(&d, sizeof(char)); if (d != 0x61) cerr << "Extraction failed!" << endl; //this always appears return 0; }
int main() { ofstream out("test.bin", ofstream::out); char c = 0x61; out.write(&c, sizeof(char)); out.close(); ifstream in("test.bin", ofstream::in); char d; in.read(&d, sizeof(char)); if (d != 0x61) cerr << "Extraction failed!" << endl; //this always appears in.close(); return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)