void LineNum(ReadFile& f) { //f.read(); int i=1; while(f.read()) { std::cout.setf(std::ios::right); std::cout.width(3); std::cout<<i++<<" "; f.Printbuffer(); } }
int ReadFile::RWOps_Read(SDL_RWops* context, void* ptr, int size, int maxnum) { ReadFile* file = (ReadFile*) context->hidden.unknown.data1; try { file->read(ptr, size, maxnum); } catch(FileReadException& e) { return e.getReadCount(); } catch(...) { return 0; } return maxnum; }
// loadTable //--------------------------------------------------------------------------- void ColorTable::loadTable(const char *filename) { ReadFile *file = FileSystem::openRead(filename); // make sure palette in file is the same as current one for(size_t i=0; i<PALETTE_LENGTH; i++) { RGBColor checkcolor; if(file->read(&checkcolor, sizeof(uint8_t), 3) != 3) throw Exception("couldn't load colortable '%s': " "file corrupted(too short)", filename); if(Palette::originalColor[i] != checkcolor) throw Exception("couldn't load colortable '%s': " "palettes don't match", filename); } // put the color table data into the colorArray if(file->read(colorArray, colorCount, 1) != 1) throw Exception("couldn't load colortable '%s': " "file corrupted(too short)", filename); delete file; } // end ColorTable::loadTable