reading binary from a file gives negative number
问题 Hey everyone this may turn out to be a simple stupid question, but one that has been giving me headaches for a while now. I'm reading data from a Named Binary Tag file, and the code is working except when I try to read big-endian numbers. The code that gets an integer looks like this: long NBTTypes::getInteger(istream &in, int num_bytes, bool isBigEndian) { long result = 0; char buff[8]; //get bytes readData(in, buff, num_bytes, isBigEndian); //convert to integer cout <<"Converting bytes to