I've been banging my head against the wall trying to understand this. I didn't find anything online, so I'm sharing it here in case someone can enlighten me.
#include <iostream>
#include <fstream>
int main(){
    std::ifstream in("bf", std::ios::binary);
    if (!in)
        return false;
    unsigned char byte;    
    while (!in.eof()){
        in >> byte;
        if (in.fail()){
            break;
        }
        std::cout<<(int)byte<<std::endl; 
    }
}
Running the above code where "bf" is a file produced by this python script:
f = open('bf','wb')
arr = bytearray([i for i in range(20)])
f.write(arr)
f.close()
Produces this output:
0
1
2
3
4
5
6
7
8
14
15
16
17
18
19
I'm running Ubuntu 18.04. Can anyone replicate the behaviour? Does anyone know what's happening?
 
    