//reading from a binary file
int r;
fstream readBinaryFile;
readBinaryFile.open("Binary file.dat", ios::in | ios::binary);
if (readBinaryFile.is_open()) {
readBinaryFile.read((char*)&r, sizeof(r));
cout << r;
readBinaryFile.close();
}
else cout << "Unable to open file!";