本文整理汇总了C++中CFile::Exist方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::Exist方法的具体用法?C++ CFile::Exist怎么用?C++ CFile::Exist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::Exist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
int CBitmap::SaveS3TC (const char *pszFolder, const char *pszFile)
{
CFile cf;
char szFilename [FILENAME_LEN], szFolder [FILENAME_LEN];
if (!m_info.compressed.bCompressed)
return 0;
if (!pszFolder)
pszFolder = gameFolders.szDataDir;
CFile::SplitPath (pszFile, NULL, szFilename, NULL);
sprintf (szFolder, "%s/dxt/", pszFolder);
strcat (szFilename, ".dxt");
if (cf.Exist (szFilename, pszFolder, 0))
return 1;
if (!cf.Open (szFilename, szFolder, "wb", 0))
return 0;
m_info.compressed.nBufSize = m_info.compressed.buffer.Size ();
if ((cf.Write (&m_info.props.w, sizeof (m_info.props.w), 1) != 1) ||
(cf.Write (&m_info.props.h, sizeof (m_info.props.h), 1) != 1) ||
(cf.Write (&m_info.compressed.nFormat, sizeof (m_info.compressed.nFormat), 1) != 1) ||
(cf.Write (&m_info.compressed.nBufSize, sizeof (m_info.compressed.nBufSize), 1) != 1) ||
(m_info.compressed.buffer.Write (cf, m_info.compressed.nBufSize) != m_info.compressed.nBufSize)) {
cf.Close ();
return 0;
}
return !cf.Close ();
}
示例2: LoadAddonBitmap
int LoadAddonBitmap (CBitmap **bmPP, const char *pszName, int *bHaveP)
{
if (!*bHaveP) {
char szFilename [FILENAME_LEN];
CFile cf;
sprintf (szFilename, "%s/d2x-xl/%s", gameFolders.szTextureDir [2], pszName);
if (!cf.Exist (szFilename, "", 0))
sprintf (szFilename, "%s/d2x-xl/%s", gameFolders.szTextureDir [0], pszName);
CBitmap *bmP = CreateAndReadTGA (szFilename);
if (!bmP)
*bHaveP = -1;
else {
*bHaveP = 1;
bmP->SetFrameCount ();
bmP->SetTranspType (-1);
bmP->Bind (1);
}
*bmPP = bmP;
}
return *bHaveP > 0;
}