本文整理汇总了C++中std::ifstream类的典型用法代码示例。如果您正苦于以下问题:C++ ifstream类的具体用法?C++ ifstream怎么用?C++ ifstream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ifstream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_file_fail
void Level::load_file_fail(std::ifstream &file, std::string s){
debug(s);
file.close();
}
示例2: processNextRecord
int ESMReaderAll::processNextRecord(std::ifstream& in_File)
{
uint32_t RecordName = 0; //normally should be 4 char, but char is not eligible for switch
int lastResult = 0;
//read record name
in_File.read((char*) &RecordName, 4);
switch(RecordName)
{
case cACTI:
lastResult = Activators::getSingleton().readNextRecord(in_File);
break;
case cALCH:
lastResult = AlchemyPotions::getSingleton().readNextRecord(in_File);
break;
case cAPPA:
lastResult = Apparatuses::getSingleton().readNextRecord(in_File);
break;
case cARMO:
lastResult = Armours::getSingleton().readNextRecord(in_File);
break;
case cBODY:
lastResult = BodyParts::getSingleton().readNextRecord(in_File);
break;
case cBOOK:
lastResult = Books::getSingleton().readNextRecord(in_File);
break;
case cBSGN:
lastResult = BirthSigns::getSingleton().readNextRecord(in_File);
break;
case cCELL:
lastResult = Cells::getSingleton().readRecordCELL(in_File);
break;
case cCLAS:
lastResult = Classes::getSingleton().readNextRecord(in_File);
break;
case cCLOT:
lastResult = Clothings::getSingleton().readNextRecord(in_File);
break;
case cCONT:
lastResult = Containers::getSingleton().readNextRecord(in_File);
break;
case cCREA:
lastResult = Creatures::getSingleton().readNextRecord(in_File);
break;
case cDIAL:
lastResult = DialogueTopics::getSingleton().readRecordDIAL(in_File);
break;
case cDOOR:
lastResult = Doors::getSingleton().readNextRecord(in_File);
break;
case cENCH:
lastResult = Enchantings::getSingleton().readNextRecord(in_File);
break;
case cFACT:
lastResult = Factions::getSingleton().readNextRecord(in_File);
break;
case cGLOB:
lastResult = Globals::getSingleton().readNextRecord(in_File);
break;
case cGMST:
lastResult = GameSettings::getSingleton().readRecordGMST(in_File);
break;
case cINFO:
lastResult = DialogueInfos::getSingleton().readNextRecord(in_File);
break;
case cINGR:
lastResult = Ingredients::getSingleton().readNextRecord(in_File);
break;
case cLAND:
lastResult = Landscape::getSingleton().readRecordLAND(in_File);
break;
case cLEVC:
lastResult = LeveledCreatures::getSingleton().readNextRecord(in_File);
break;
case cLEVI:
lastResult = LeveledItems::getSingleton().readNextRecord(in_File);
break;
case cLIGH:
lastResult = Lights::getSingleton().readNextRecord(in_File);
break;
case cLOCK:
lastResult = Lockpicks::getSingleton().readNextRecord(in_File);
break;
case cLTEX:
lastResult = LandscapeTextures::getSingleton().readNextRecord(in_File);
break;
case cMGEF:
lastResult = MagicEffects::getSingleton().readRecordMGEF(in_File);
break;
case cMISC:
lastResult = MiscItems::getSingleton().readNextRecord(in_File);
break;
case cNPC_:
lastResult = NPCs::getSingleton().readNextRecord(in_File);
break;
case cPGRD:
lastResult = PathGrids::getSingleton().readRecordPGRD(in_File);
break;
case cPROB:
//.........这里部分代码省略.........
示例3: get_line
void get_line(std::ifstream fin, char *buff, int buff_len, int &read_len) {
fin.getline(buff, buff_len);
read_len = fin.gcount();
buff[INPUT_LINE_SIZE - 1] = '\0';
}
示例4: sizeof
std::unique_ptr<TorchStage> SpatialDropout::loadFromFile(std::ifstream& file) {
float p;
file.read((char*)(&p), sizeof(p));
return std::unique_ptr<TorchStage>(new SpatialDropout(p));
}
示例5: loadFromStream
bool CameraPathRecord::loadFromStream(std::ifstream& in_File, const bool localized, const StringTable& table)
{
uint32_t readSize = 0;
if (!loadSizeAndUnknownValues(in_File, readSize)) return false;
uint32_t subRecName;
uint16_t subLength;
subRecName = subLength = 0;
uint32_t bytesRead = 0;
//read EDID
char buffer[512];
if (!loadString512FromStream(in_File, editorID, buffer, cEDID, true, bytesRead))
return false;
conditions.clear();
CTDA_CIS1_compound tempCC;
bool hasCTDA = false;
bool hasReadANAM = false;
bool hasReadDATA = false;
camShotList.clear();
uint32_t tempUint32;
while (bytesRead<readSize)
{
//read next subrecord's name
in_File.read((char*) &subRecName, 4);
bytesRead += 4;
switch(subRecName)
{
case cCTDA:
if (hasCTDA)
{
conditions.push_back(tempCC);
}
//load CTDA
if (!tempCC.unknownCTDA.loadFromStream(in_File, bytesRead)) return false;
hasCTDA = true;
tempCC.unknownCISx.clear();
break;
case cCIS1:
if (!hasCTDA)
{
std::cout << "Error: CPTH has CIS1 subrecord without prior CTDA!\n";
return false;
}
if (!tempCC.unknownCISx.empty())
{
std::cout << "Error: CPTH seems to have more than one CIS1 per CTDA!\n";
return false;
}
//load CIS1
if (!loadString512FromStream(in_File, tempCC.unknownCISx, buffer, cCIS1, false, bytesRead))
return false;
//check content
if (tempCC.unknownCISx.empty())
{
std::cout << "Error: subrecord CIS1 of CPTH is empty!\n";
return false;
}
conditions.push_back(tempCC);
hasCTDA = false;
break;
case cANAM:
if (hasReadANAM)
{
std::cout << "Error: CPTH seems to have more than one ANAM subrecord!\n";
return false;
}
//ANAM's length
in_File.read((char*) &subLength, 2);
bytesRead += 2;
if (subLength!=8)
{
std::cout <<"Error: subrecord ANAM of CPTH has invalid length ("
<<subLength <<" bytes). Should be eight bytes!\n";
return false;
}
//read ANAM's stuff
in_File.read((char*) &cameraPathLinks.parentFormID, 4);
in_File.read((char*) &cameraPathLinks.nextFormID, 4);
bytesRead += 8;
if (!in_File.good())
{
std::cout << "Error while reading subrecord ANAM of CPTH!\n";
return false;
}//if
hasReadANAM = true;
break;
case cDATA:
if (hasReadDATA)
{
std::cout << "Error: CPTH seems to have more than one DATA subrecord!\n";
return false;
}
//DATA's length
in_File.read((char*) &subLength, 2);
bytesRead += 2;
if (subLength!=1)
{
std::cout <<"Error: subrecord DATA of CPTH has invalid length ("
//.........这里部分代码省略.........
示例6: loadFromStream
bool DestructionData::loadFromStream(std::ifstream& in_File, const uint32_t recordType, char * buffer, uint32_t& bytesRead)
{
//DEST's length
uint16_t subLength = 0;
in_File.read((char*) &subLength, 2);
bytesRead += 2;
if (subLength!=8)
{
std::cout << "Error: subrecord DEST of "<<IntTo4Char(recordType)<<" has invalid length ("
<< subLength << " bytes). Should be eight bytes.\n";
return false;
}
//read DEST
in_File.read((char*) &health, 4);
in_File.read((char*) &stageCount, 1);
in_File.read((char*) &unknownTwo, 1);
in_File.read((char*) &unknownThreeFour, 2);
bytesRead += 8;
if (!in_File.good())
{
std::cout << "Error while reading subrecord DEST of "<<IntTo4Char(recordType)<<"!\n";
return false;
}
isPresent = true;
stages.clear();
DestructionStage tempStage;
while (stages.size()<stageCount)
{
//read next record
uint32_t innerRecordName = 0;
in_File.read((char*) &innerRecordName, 4);
bytesRead += 4;
switch (innerRecordName)
{
case cDSTD:
if (tempStage.unknownDSTD.isPresent())
{
std::cout << "Error: "<<IntTo4Char(recordType)<<" seems to have more than one DSTD subrecord per stage!\n";
return false;
}//if
//read DSTD
if (!tempStage.unknownDSTD.loadFromStream(in_File, cDSTD, false)) return false;
bytesRead += (2+tempStage.unknownDSTD.getSize());
break;
case cDMDL:
if (!tempStage.replacementModel.empty())
{
std::cout << "Error: "<<IntTo4Char(recordType)<<" seems to have more than one DMDL subrecord per stage!\n";
return false;
}//if
//DMDL's length
in_File.read((char*) &subLength, 2);
bytesRead += 2;
if (subLength>511)
{
std::cout <<"Error: sub record DMDL of "<<IntTo4Char(recordType)<<" is longer than 511 characters!\n";
return false;
}
//read string
memset(buffer, 0, 512);
in_File.read(buffer, subLength);
bytesRead += subLength;
if (!in_File.good())
{
std::cout << "Error while reading subrecord DMDL of "<<IntTo4Char(recordType)<<"!\n";
return false;
}
tempStage.replacementModel = std::string(buffer);
//check content
if (tempStage.replacementModel.empty())
{
std::cout << "Error: subrecord DMDL of "<<IntTo4Char(recordType)<<" is empty!\n";
return false;
}
break;
case cDMDT:
if (tempStage.unknownDMDT.isPresent())
{
std::cout << "Error: "<<IntTo4Char(recordType)
<< " seems to have more than one DMDT subrecord per stage!\n";
return false;
}//if
//read DMDT
if (!tempStage.unknownDMDT.loadFromStream(in_File, cDMDT, false)) return false;
bytesRead += (2+tempStage.unknownDMDT.getSize());
break;
case cDSTF:
//DSTF's length
in_File.read((char*) &subLength, 2);
bytesRead += 2;
if (subLength!=0)
{
std::cout << "Error: subrecord DSTF of "<<IntTo4Char(recordType)
<< " has invalid length (" << subLength
<< " bytes). Should be zero bytes.\n";
return false;
}
//push it, if not empty
//.........这里部分代码省略.........
示例7: sizeof
void Q3BSPLoad::LoadBSPData(std::ifstream& aFile)
{
//Load leaves
//Calculate number of leaves
int numLeaves=m_header.m_directoryEntries[bspLeaves].m_length/sizeof(BSP_LOAD_LEAF);
//Create space for this many BSP_LOAD_LEAFS
m_loadLeaves.resize(numLeaves);
//Load leaves
aFile.seekg(m_header.m_directoryEntries[bspLeaves].m_offset,std::ios::beg);
aFile.read((char*)&m_loadLeaves[0], m_header.m_directoryEntries[bspLeaves].m_length);
//Load leaf faces array
int num_leaf_faces=m_header.m_directoryEntries[bspLeafFaces].m_length/sizeof(int);
//Create space for this many leaf faces
m_loadLeafFaces.resize(num_leaf_faces);
//Load leaf faces
aFile.seekg(m_header.m_directoryEntries[bspLeafFaces].m_offset,std::ios::beg);
aFile.read((char*)&m_loadLeafFaces[0], m_header.m_directoryEntries[bspLeafFaces].m_length);
//Load Planes
int num_planes=m_header.m_directoryEntries[bspPlanes].m_length/sizeof(BSP_LoadPlane);
//Create space for this many planes
m_loadPlanes.resize(num_planes);
aFile.seekg(m_header.m_directoryEntries[bspPlanes].m_offset,std::ios::beg);
aFile.read((char*)&m_loadPlanes[0], m_header.m_directoryEntries[bspPlanes].m_length);
//Load nodes
int num_nodes=m_header.m_directoryEntries[bspNodes].m_length/sizeof(BSP_NODE);
//Create space for this many nodes
m_loadNodes.resize(num_nodes);
aFile.seekg(m_header.m_directoryEntries[bspNodes].m_offset,std::ios::beg);
aFile.read((char*)&m_loadNodes[0], m_header.m_directoryEntries[bspNodes].m_length);
//Load visibility data
//load numClusters and bytesPerCluster
aFile.seekg(m_header.m_directoryEntries[bspVisData].m_offset,std::ios::beg);
aFile.read((char*)&m_loadVisibilityData, 2 * sizeof(int));
//Calculate the size of the bitset
int bitsetSize=m_loadVisibilityData.m_numClusters*m_loadVisibilityData.m_bytesPerCluster;
//Create space for bitset
m_loadVisibilityData.m_bitset.resize(bitsetSize);
//read bitset
aFile.read((char*)&m_loadVisibilityData.m_bitset[0], bitsetSize);
}
示例8: loadFromStream
bool ApparatusRecord::loadFromStream(std::ifstream& in_File)
{
uint32_t Size;
in_File.read((char*) &Size, 4);
in_File.read((char*) &HeaderOne, 4);
in_File.read((char*) &HeaderFlags, 4);
/*Alchemy Apparatus:
NAME = Item ID, required
MODL = Model Name, required
FNAM = Item Name, required
AADT = Alchemy Data (16 bytes), required
long Type (0=Mortar and Pestle,1=Albemic,2=Calcinator,3=Retort)
float Quality
float Weight
long Value
ITEX = Inventory Icon
SCRI = Script Name (optional) */
uint32_t SubRecName;
uint32_t SubLength, BytesRead;
SubRecName = SubLength = 0;
//read NAME
in_File.read((char*) &SubRecName, 4);
BytesRead = 4;
if (SubRecName!=cNAME)
{
UnexpectedRecord(cNAME, SubRecName);
return false;
}
//NAME's length
in_File.read((char*) &SubLength, 4);
BytesRead += 4;
if (SubLength>255)
{
std::cout << "Subrecord NAME of APPA is longer than 255 characters!\n";
return false;
}
char Buffer[256];
memset(Buffer, '\0', 256);
//read apparatus ID
in_File.read(Buffer, SubLength);
BytesRead += SubLength;
if (!in_File.good())
{
std::cout << "Error while reading subrecord NAME of APPA!\n";
return false;
}
recordID = std::string(Buffer);
Model.clear();
ItemName.clear();
bool hasReadAADT = false;
InventoryIcon.clear();
ScriptName.clear();
while (BytesRead<Size)
{
//read sub record's name
in_File.read((char*) &SubRecName, 4);
BytesRead += 4;
switch (SubRecName)
{
case cMODL:
if (!Model.empty())
{
std::cout << "Error: APPA seems to have more than one MODL subrecord!\n";
return false;
}
//MODL's length
in_File.read((char*) &SubLength, 4);
BytesRead += 4;
if (SubLength>255)
{
std::cout << "Subrecord MODL of APPA is longer than 255 characters!\n";
return false;
}
//read model path
memset(Buffer, '\0', 256);
in_File.read(Buffer, SubLength);
BytesRead += SubLength;
if (!in_File.good())
{
std::cout << "Error while reading subrecord MODL of APPA!\n";
return false;
}
Model = std::string(Buffer);
if (Model.empty())
{
std::cout << "Error: subrecord MODL of APPA is empty!\n";
return false;
}
break;
case cFNAM:
if (!ItemName.empty())
{
std::cout << "Error: APPA seems to have more than one FNAM subrecord!\n";
return false;
}
//.........这里部分代码省略.........
示例9: eat_blankspace
static inline void eat_blankspace(std::ifstream &f)
{
while (isblank(f.peek())) {
f.get();
}
}
示例10: eat_whitespace
static inline void eat_whitespace(std::ifstream &f)
{
while (isspace(f.peek())) {
f.get();
}
}
示例11: loadFromStream
bool PerkRecord::loadFromStream(std::ifstream& in_File, const bool localized, const StringTable& table)
{
uint32_t readSize = 0;
if (!loadSizeAndUnknownValues(in_File, readSize)) return false;
uint32_t subRecName;
uint16_t subLength;
subRecName = subLength = 0;
uint32_t bytesRead;
//read EDID
in_File.read((char*) &subRecName, 4);
bytesRead = 4;
if (subRecName!=cEDID)
{
UnexpectedRecord(cEDID, subRecName);
return false;
}
//EDID's length
in_File.read((char*) &subLength, 2);
bytesRead += 2;
if (subLength>511)
{
std::cout <<"Error: sub record EDID of PERK is longer than 511 characters!\n";
return false;
}
//read EDID's stuff
char buffer[512];
memset(buffer, 0, 512);
in_File.read(buffer, subLength);
bytesRead += subLength;
if (!in_File.good())
{
std::cout << "Error while reading subrecord EDID of PERK!\n";
return false;
}
editorID = std::string(buffer);
//now read the rest
unknownVMAD.setPresence(false);
name.reset();
description.reset();
subBlocks.clear();
SubBlock temp;
while (bytesRead<readSize)
{
//read next subrecord's name
in_File.read((char*) &subRecName, 4);
bytesRead += 4;
switch (subRecName)
{
case cVMAD:
if (unknownVMAD.isPresent())
{
std::cout << "Error: record PERK seems to have more than one VMAD subrecord.\n";
return false;
}
if (!unknownVMAD.loadFromStream(in_File, cVMAD, false)) return false;
bytesRead += (2 +unknownVMAD.getSize());
break;
case cFULL:
if (name.isPresent())
{
std::cout << "Error: record PERK seems to have more than one FULL subrecord.\n";
return false;
}
//read FULL
if (!name.loadFromStream(in_File, cFULL, false, bytesRead, localized, table, buffer))
return false;
break;
case cDESC:
if (description.isPresent())
{
std::cout << "Error: record PERK seems to have more than one DESC subrecord.\n";
return false;
}
//read DESC
if (!description.loadFromStream(in_File, cDESC, false, bytesRead, localized, table, buffer))
return false;
break;
default:
temp.subType = subRecName;
if (!temp.subData.loadFromStream(in_File, subRecName, false))
{
std::cout << "Error while reading subrecord "<<IntTo4Char(subRecName)
<< " of PERK!\n";
return false;
}
bytesRead += (2 +temp.subData.getSize());
subBlocks.push_back(temp);
break;
}//swi
}//while
if (!description.isPresent())
{
std::cout << "Error: subrecord DESC of PERK is missing!\n";
return false;
}
return in_File.good();
//.........这里部分代码省略.........
示例12: readOptimisedCoordinates
void GamessukOut::readOptimisedCoordinates(std::ifstream &ifs)
{
//std::cout << "readOptimisedCoordinates\n";
double x,y,z;
// Nuke the old coordinates
gukBasis.atomLabels.clear();
gukBasis.coordinates.clear();
ifs.getline(buffer, BUFF_SIZE);
while( ! ifs.eof() )
{
// This for some optimize runtypes
if ( strstr(buffer," x y z chg tag") != NULL )
{
//std::cout << "start of opt coord\n";
// Skip 2 lines - should then be at the coordinates
ifs.getline(buffer, BUFF_SIZE) && ifs.getline(buffer, BUFF_SIZE);
while( ! ifs.eof() )
{
// End of geometry block
if ( strstr(buffer, " ============================================================") != NULL) return;
tokenize(tokens, buffer, " \t\n");
from_string<double>(x, tokens.at(0), std::dec);
from_string<double>(y, tokens.at(1), std::dec);
from_string<double>(z, tokens.at(2), std::dec);
gukBasis.coordinates.push_back( Eigen::Vector3d( x, y, z ));
gukBasis.atomLabels.push_back(tokens.at(4));
ifs.getline(buffer, BUFF_SIZE);
} // end while
}
else if ( strstr(buffer,"atom znuc x y z") != NULL )
{
// print "start of opt coord 2"
// Skip 3 lines - should then be at the coordinates
ifs.getline(buffer, BUFF_SIZE) && ifs.getline(buffer, BUFF_SIZE) &&
ifs.getline(buffer, BUFF_SIZE);
while( ! ifs.eof() )
{
// End of geometry block
if ( strstr(buffer, "*************************") != NULL) return;
tokenize(tokens, buffer, " \t\n");
gukBasis.atomLabels.push_back(tokens.at(0));
from_string<double>(x, tokens.at(3), std::dec);
from_string<double>(y, tokens.at(4), std::dec);
from_string<double>(z, tokens.at(5), std::dec);
gukBasis.coordinates.push_back( Eigen::Vector3d( x, y, z ));
ifs.getline(buffer, BUFF_SIZE);
} // end of while
}
ifs.getline(buffer, BUFF_SIZE);
} // end of read loop
} // end readOptimisedCoordinates
示例13: readMOVectors
int GamessukOut::readMOVectors(std::ifstream &ifs)
{
/*
Loop through a series of columns of printed MO vectors & return the
number of orbitals read in
*/
unsigned int norbitals, norbitalsRead;
double energy;
ifs.getline(buffer, BUFF_SIZE);
//std::cout << "HeaderLine " << buffer << std::endl;
// Check we're not at the end
if ( strstr(buffer, "end of")!=0 ) return 0;
tokenize(tokens, buffer, " \t\n");
// How many orbital columns:
norbitals = static_cast<unsigned int>(tokens.size());
for ( unsigned int i=0; i < tokens.size() ; i++ )
{
from_string<double>(energy, tokens.at(i), std::dec);
//std::cout << "adding e " << energy << std::endl;
gukBasis.moEnergies.push_back(energy);
}
// Add the lists to hold this set of coefficients
// How many were read in previously:
norbitalsRead = static_cast<unsigned int>(gukBasis.moVectors.size());
// Create the arrays to hold the coefficients for each orbital
for ( unsigned int i=0; i < norbitals ; i++ )
gukBasis.moVectors.push_back( std::vector<double>() );
//skip 5 lines to just before where first set of orbitals are printed
ifs.getline(buffer, BUFF_SIZE) &&
ifs.getline(buffer, BUFF_SIZE) &&
ifs.getline(buffer, BUFF_SIZE) &&
ifs.getline(buffer, BUFF_SIZE) &&
ifs.getline(buffer, BUFF_SIZE);
// loop nBasisFunctions times to read in up to norbitals coefficients
for (int i=0; i < gukBasis.nBasisFunctions ; i++ )
{
ifs.getline( buffer, BUFF_SIZE );
//std::cout << "MO line " << buffer << std::endl;
tokenize(tokens, buffer, " \t\n");
for (unsigned int j=0; j < norbitals ; j++ )
{
// reuse variable energy to hold coefficient
from_string<double>(energy, tokens.at(j+4), std::dec);
gukBasis.moVectors.at(norbitalsRead+j).push_back(energy);
//std::cout << "Adding " << energy << " to vector " << norbitalsRead+j << std::endl;
}
}
// skip 2 lines to where the next set of headers are printed
ifs.getline(buffer, BUFF_SIZE);
ifs.getline(buffer, BUFF_SIZE);
// If we are printed out after an optimisation under the control of "iprint vectors",
// the next line with be filled with " =================" if we've finished
if ( strstr(buffer, " ===============================")!=0 ) return 0;
return norbitals;
} // end readMOVectors
示例14: parse
/**
* Parses an .idx file.
*/
std::vector<Reference> parse(std::ifstream& fs)
{
uint32_t size;
uint32_t hash;
fs >> le >> size;
fs >> le >> hash;
uint32_t headerHash{ 0 };
if ((hash != (headerHash = Crypto::lookup3(fs, size, 0))))
{
throw Exceptions::InvalidHashException(hash, headerHash, "");
}
uint16_t version;
uint16_t bucket;
uint8_t lengthFieldSize;
uint8_t locationFieldSize;
uint8_t keyFieldSize;
uint8_t segmentBits;
fs >> le >> version;
fs >> le >> bucket;
fs >> lengthFieldSize;
fs >> locationFieldSize;
fs >> keyFieldSize;
fs >> segmentBits;
this->versions_[bucket] = version;
this->keySize_[bucket] = keyFieldSize;
for (unsigned int i = 0; i < (size - 8); i += 8)
{
uint32_t dataBeg;
uint32_t dataEnd;
fs >> be >> dataBeg;
fs >> be >> dataEnd;
}
fs.seekg(16 - ((8 + size) % 16), std::ios_base::cur);
fs >> le >> size;
fs >> le >> hash;
std::pair<uint32_t, uint32_t> dataHash{ 0, 0 };
std::vector<char> data(size);
fs.read(data.data(), data.size());
std::vector<Reference> files(size / 18);
files.reserve(size / 18);
for (auto i = 0U; i < (size / 18); ++i)
{
auto begin = data.begin() + 18 * i;
auto end = begin + 18;
files.emplace_back(begin, end,
keyFieldSize,
locationFieldSize,
lengthFieldSize,
segmentBits);
dataHash = Crypto::lookup3(begin, end, dataHash);
}
if (hash != dataHash.first)
{
throw Exceptions::InvalidHashException(hash, dataHash.first, "");
}
fs.seekg(0xE000 - ((8 + size) % 0xD000), std::ios_base::cur);
return files;
}
示例15: load
void Toggle::load(std::ifstream& ifs) {
int data = 0;
ifs.read((char*)&data, sizeof(int));
value = (data == 1);
needsRedraw();
}