for(int i = 0; i < 112 && infile.tellg() <= 37854; i++){ for(int j = 0; j < 112 && infile.tellg() <= 37854; j++){ infile.get(in); infile.ignore(); // ignore the next character (this was probably originally stored as an int) //outfile << typetxt((unsigned char) in); if(i % 2){ // if i is odd bmpdata[i / 2][j] |= type((unsigned char)in); // set the low bits }else{ bmpdata[i / 2][j] |= type((unsigned char)in) << 4; // set the high bits } } //outfile << endl; }