i happened to have these at hand, so here's lazy time:
int openBinFile(fstream &myfile, const char *myfile_name) {
myfile.open (myfile_name, ios::in|ios::out|ios::binary );
if (false == myfile.is_open()) {
cout << "Error opening " << myfile_name << "\n";
return 2;
} else {
cout << "File " << myfile_name << " has been opened OK.\n";
return 0;
}
}
fstream in_file;
// open it up with previous function, then
char file_data;
in_file.read((char*)(&file_data), sizeof(char));
I let file_data in a single byte as per Ditch's comment, so you need to iterate on this.