Below is some code I found which to my minimal understanding reads in a binary file. I have commented what I believe to be happening however i'm having trouble recognizing what exactly memblock is/ what it is storing. Is it the entire binary file?
void BinaryFiles(string sfile){
streampos size; //creates object to store size of file
unsigned char* memblock;
ifstream file(sfile, ios::in | ios::binary); //creates file object(which opens file)
if (file.is_open())
{
file.seekg(0, ios::end); //find end of file
size = file.tellg(); //sets size equal to distance from beginning
memblock = new unsigned char[size]; //dynamically allocates memblock to char array
file.seekg(0, ios::beg); //find beginning of file
file.read((char*)memblock, size); //this is where confusion begins
cout << memblock << endl; //what am I printing?
file.close();
delete[] memblock;
}
}