本文整理汇总了C++中DiskFile::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ DiskFile::Create方法的具体用法?C++ DiskFile::Create怎么用?C++ DiskFile::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiskFile
的用法示例。
在下文中一共展示了DiskFile::Create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Work out which files are being repaired, create them, and allocate
// target DataBlocks to them, and remember them for later verification.
bool Par1Repairer::CreateTargetFiles(void) {
vector<Par1RepairerSourceFile*>::iterator sf = sourcefiles.begin();
// Create any missing target files
while (sf != sourcefiles.end()) {
Par1RepairerSourceFile *sourcefile = *sf;
// If the file does not exist
if (!sourcefile->GetTargetExists()) {
DiskFile *targetfile = new DiskFile;
string filename = sourcefile->FileName();
u64 filesize = sourcefile->FileSize();
// Create the target file
if (!targetfile->Create(filename, filesize)) {
delete targetfile;
return false;
}
// This file is now the target file
sourcefile->SetTargetExists(true);
sourcefile->SetTargetFile(targetfile);
// Remember this file
bool success = diskfilemap.Insert(targetfile);
assert(success);
sourcefile->SetTargetBlock(targetfile);
// Add the file to the list of those that will need to be verified
// once the repair has completed.
verifylist.push_back(sourcefile);
}
++sf;
}
return true;
}