I want to understand how does reading binary files work in C++. My code:
int main() {
    ifstream ifd("input.png",ios::binary |ios::ate);
    int size = ifd.tellg();
    ifd.seekg(0,  ios::beg);
    vector<char> buffer;
    buffer.reserve(size);
    ifd.read(buffer.data(), size);
    cout << buffer.data();
    return 0;
}
I thought that if I cout my buffer I would get the result in binary but that is not the case.
My output is: ˙Ř˙á6Exif 
And if I read the text file it displays the text in normal form not in binary. Obviously my logic is not right here. How can I read files to a buffer so it will contain binary values? P.s. I`m doing this for implementing a Shannon-Fano algorithm so if anyone has any advice on reading a binary file I would be grateful.
 
     
     
     
    