本文整理汇总了C++中CFile::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::Create方法的具体用法?C++ CFile::Create怎么用?C++ CFile::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveList
void CFriendList::SaveList()
{
CFile file;
if (file.Create(theApp->ConfigDir + wxT("emfriends.met"), true)) {
try {
file.WriteUInt8(MET_HEADER);
file.WriteUInt32(m_FriendList.size());
for (FriendList::iterator it = m_FriendList.begin(); it != m_FriendList.end(); ++it) {
(*it)->WriteToFile(&file);
}
} catch (const CIOFailureException& e) {
AddDebugLogLineC(logGeneral, wxT("IO failure while saving 'emfriends.met': ") + e.what());
}
} else {
AddLogLineN(_("Failed to open friend list file 'emfriends.met' for writing!"));
}
}
示例2: performConvertToeMule
ConvStatus CPartFileConvert::performConvertToeMule(const CPath& fileName)
{
wxString filepartindex;
CPath folder = fileName.GetPath();
CPath partfile = fileName.GetFullName();
CPath newfilename;
CDirIterator finder(folder);
Notify_ConvertUpdateProgressFull(0, _("Reading temp folder"), s_pfconverting->folder.GetPrintable());
filepartindex = partfile.RemoveAllExt().GetRaw();
Notify_ConvertUpdateProgress(4, _("Retrieving basic information from download info file"));
CPartFile* file = new CPartFile();
s_pfconverting->partmettype = file->LoadPartFile(folder, partfile, false, true);
switch (s_pfconverting->partmettype) {
case PMT_UNKNOWN:
case PMT_BADFORMAT:
delete file;
return CONV_BADFORMAT;
}
CPath oldfile = folder.JoinPaths(partfile.RemoveExt());
{
wxMutexLocker lock(s_mutex);
s_pfconverting->size = file->GetFileSize();
s_pfconverting->filename = file->GetFileName();
s_pfconverting->filehash = file->GetFileHash().Encode();
}
Notify_ConvertUpdateJobInfo(s_pfconverting);
if (theApp->downloadqueue->GetFileByID(file->GetFileHash())) {
delete file;
return CONV_ALREADYEXISTS;
}
if (s_pfconverting->partmettype == PMT_SPLITTED) {
unsigned fileindex;
char *ba = new char [PARTSIZE];
try {
CFile inputfile;
// just count
unsigned maxindex = 0;
unsigned partfilecount = 0;
CPath filePath = finder.GetFirstFile(CDirIterator::File, filepartindex + wxT(".*.part"));
while (filePath.IsOk()) {
long l;
++partfilecount;
filePath.GetFullName().RemoveExt().GetExt().ToLong(&l);
fileindex = (unsigned)l;
filePath = finder.GetNextFile();
if (fileindex > maxindex) maxindex = fileindex;
}
float stepperpart;
{
wxMutexLocker lock(s_mutex);
if (partfilecount > 0) {
stepperpart = (80.0f / partfilecount);
if (maxindex * PARTSIZE <= s_pfconverting->size) {
s_pfconverting->spaceneeded = maxindex * PARTSIZE;
} else {
s_pfconverting->spaceneeded = s_pfconverting->size;
}
} else {
stepperpart = 80.0f;
s_pfconverting->spaceneeded = 0;
}
}
Notify_ConvertUpdateJobInfo(s_pfconverting);
sint64 freespace = CPath::GetFreeSpaceAt(thePrefs::GetTempDir());
if (freespace != wxInvalidOffset) {
if (static_cast<uint64>(freespace) < maxindex * PARTSIZE) {
delete file;
delete [] ba;
return CONV_OUTOFDISKSPACE;
}
}
// create new partmetfile, and remember the new name
file->CreatePartFile();
newfilename = file->GetFullName();
Notify_ConvertUpdateProgress(8, _("Creating destination file"));
file->m_hpartfile.SetLength( s_pfconverting->spaceneeded );
unsigned curindex = 0;
CPath filename = finder.GetFirstFile(CDirIterator::File, filepartindex + wxT(".*.part"));
while (filename.IsOk()) {
// stats
//.........这里部分代码省略.........