本文整理汇总了C++中CFile::CloseFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::CloseFile方法的具体用法?C++ CFile::CloseFile怎么用?C++ CFile::CloseFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::CloseFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
_UINT32 CPPTXFile::ConvertPPTYToPPTX(std::wstring bsInput, std::wstring bsOutput, std::wstring bsThemesFolder)//bsOutput и файл и директория может быть
{
OOX::CPath pathLocalTempDirectory;
if (m_fCallbackCompress)//если компрессора нет - конвертим в назначеную директорию
pathLocalTempDirectory = m_strTempDir ;
else
pathLocalTempDirectory = bsOutput; //выходной файл - папка
#ifdef _DEBUG
#if defined(_WIN32) || defined (_WIN64)
if (m_fCallbackCompress)
pathLocalTempDirectory = _T("C:\\PPTMemory\\PPTX_test");
#endif
#endif
NSBinPptxRW::CPPTXWriter oWriter;
oWriter.Init(pathLocalTempDirectory.GetPath());
CFile oFileBinary;
oFileBinary.OpenFile((std::wstring)bsInput);
LONG lFileSize = (LONG)oFileBinary.GetFileSize();
BYTE* pSrcBuffer = new BYTE[lFileSize];
oFileBinary.ReadFile(pSrcBuffer, (DWORD)lFileSize);
oFileBinary.CloseFile();
std::wstring strBsInput = bsInput;
std::wstring srcFolder = NSDirectory::GetFolderPath(strBsInput);
oWriter.OpenPPTY(pSrcBuffer, lFileSize, srcFolder, bsThemesFolder);
RELEASEARRAYOBJECTS(pSrcBuffer);
_UINT32 hRes = 0;
if (m_fCallbackCompress)
{
std::wstring strOutput = bsOutput;
std::wstring strInput = pathLocalTempDirectory.GetPath();
hRes = m_fCallbackCompress(m_pCallbackArg, strInput, strOutput) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
NSDirectory::DeleteDirectory(strInput);
}
return hRes;
}
示例2: DetectTypeDocument
std::wstring COfficeOdfFileW::DetectTypeDocument(const std::wstring & pathOOX)
{
std::wstring sRes;
CFile file;
CString fileContentType = std_string2string(pathOOX + FILE_SEPARATOR_STR + L"[Content_Types].xml");
if (file.OpenFile(fileContentType) != S_OK) return sRes;
int nBufferSize = min (file.GetFileSize(), 4096);
BYTE *pBuffer = new BYTE[nBufferSize];
file.ReadFile(pBuffer, nBufferSize);
file.CloseFile();
if (pBuffer != NULL)
{
const char *docxFormatLine = "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml";
const char *dotxFormatLine = "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml";
const char *docmFormatLine = "application/vnd.ms-word.document.macroEnabled.main+xml";
const char *dotmFormatLine = "application/vnd.ms-word.template.macroEnabledTemplate.main+xml";
const char *xlsxFormatLine = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
const char *xltxFormatLine = "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml";
const char *xlsmFormatLine = "application/vnd.ms-excel.sheet.macroEnabled.main+xml";
const char *xltmFormatLine = "application/vnd.ms-excel.template.macroEnabled.main+xml";
const char *pptxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
const char *ppsxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml";
const char *potxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml";
const char *pptmFormatLine = "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml";
const char *ppsmFormatLine = "application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml";
const char *potmFormatLine = "application/vnd.ms-powerpoint.template.macroEnabled.main+xml";
std::string strContentTypes((char*)pBuffer, nBufferSize);
int res = 0;
if ( (res = strContentTypes.find(docxFormatLine))>0 || (res = strContentTypes.find(dotxFormatLine))>0 ||
(res = strContentTypes.find(docmFormatLine))>0 || (res = strContentTypes.find(dotmFormatLine))>0)
{
sRes = L"text";
}
else if ((res = strContentTypes.find(xlsxFormatLine))>0 || (res = strContentTypes.find(xltxFormatLine))>0 ||
(res = strContentTypes.find(xlsmFormatLine))>0 || (res = strContentTypes.find(xltmFormatLine))>0)
{
sRes = L"spreadsheet";
}
else if ((res = strContentTypes.find(pptxFormatLine) > 0) || /*(res = strContentTypes.find(ppsxFormatLine))>0 ||*/
(res = strContentTypes.find(potxFormatLine))>0 || (res = strContentTypes.find(pptmFormatLine))>0 ||
(res = strContentTypes.find(ppsmFormatLine))>0 || (res = strContentTypes.find(potmFormatLine))>0 ||
(res = strContentTypes.find(ppsxFormatLine)) >0 )
{
}
delete []pBuffer;
pBuffer = NULL;
}
return sRes;
}
示例3: _tmain
//.........这里部分代码省略.........
{
strFontInfo += pPair->m_value.namesR[i];
strFontInfo += _T(",");
}
strFontInfo += _T(";");
for (size_t i = 0; i < pPair->m_value.namesI.GetCount(); ++i)
{
strFontInfo += pPair->m_value.namesI[i];
strFontInfo += _T(",");
}
strFontInfo += _T(";");
for (size_t i = 0; i < pPair->m_value.namesB.GetCount(); ++i)
{
strFontInfo += pPair->m_value.namesB[i];
strFontInfo += _T(",");
}
strFontInfo += _T(";");
for (size_t i = 0; i < pPair->m_value.namesBI.GetCount(); ++i)
{
strFontInfo += pPair->m_value.namesBI[i];
strFontInfo += _T(",");
}
strFontInfo += _T("]\n");
strInfos += strFontInfo;
}
oFile.WriteStringUTF8(strInfos);
oFile.CloseFile();
#endif
CFile oFileW;
oFileW.CreateFile(strFontDictionaryPath);
BYTE bom[3];
bom[0] = 0xEF;
bom[1] = 0xBB;
bom[2] = 0xBF;
oFileW.WriteFile((void*)&bom, 3);
CString strAll = _T("");
CString strConstant1 = _T("#ifndef _FONT_DICTIONARY_H\n\n\
typedef struct FD_FontMapRec_\n\
{\n\
const char* m_name;\n\
\n\
int m_index_r;\n\
int m_index_i;\n\
int m_index_b;\n\
int m_index_bi;\n\
} FD_FontMapRec;\n\n\
typedef struct FD_FontMapRecW_\n\
{\n\
const wchar_t* m_name;\n\
\n\
int m_index_r;\n\
int m_index_i;\n\
int m_index_b;\n\
int m_index_bi;\n\
} FD_FontMapRecW;\n\n");