int CLevel::ReadInt( FILE* aFptr ) { int temp; if ( fread( &temp, sizeof(int), 1, aFptr ) != 1 ) { if ( feof( aFptr ) ) throw CEOFException("CLevel::ReadInt: file end reached!"); else throw CFailureException("CLevel::ReadInt: fread failed!"); } return SDL_SwapLE32(temp); }
void CFileDataIO::Read(void *buffer, size_t count) const { MULE_VALIDATE_PARAMS(buffer, wxT("Attempting to write to NULL buffer.")); // Check that we read everything we wanted. if (doRead(buffer, count) == (signed)count) { return; } // To reduce potential system calls, we only do EOF checks when reads fail. if (Eof()) { throw CEOFException(wxT("Attempt to read past end of file.")); } else { throw CIOFailureException(wxT("Read error, failed to read from file.")); } }