fstream file("path", std::fstream::binary | std::fstream::in); unsigned char buf[2]; file.read((char*)buf, 2); file.close(); uint16_t num = buf[0] | (buf[1] << 8);