当前位置: 首页>>代码示例>>C++>>正文


C++ CFile::Delete方法代码示例

本文整理汇总了C++中CFile::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::Delete方法的具体用法?C++ CFile::Delete怎么用?C++ CFile::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFile的用法示例。


在下文中一共展示了CFile::Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CopyPigFileFromCD

//------------------------------------------------------------------------------
//copies a pigfile from the CD to the current dir
//retuns file handle of new pig
int CopyPigFileFromCD (CFile& cf, char *filename)
{
return cf.Open (filename, gameFolders.szDataDir, "rb", 0);
#if 0
	char name [80];
	FFS ffs;
	int ret;

messageBox.Show ("Copying bitmap data from CD...");
paletteManager.LoadEffect ();    //I don't think this line is really needed
//First, delete all PIG files currently in the directory
if (!FFF ("*.pig", &ffs, 0)) {
	do {
		cf.Delete (ffs.name, "");
	} while (!FFN  (&ffs, 0));
	FFC (&ffs);
}
//Now, copy over new pig
redbook.Stop ();           //so we can read off the cd
//new code to unarj file
strcpy (name, CDROM_dir);
strcat (name, "descent2.sow");
do {
//	ret = unarj_specific_file (name,filename,filename);
// DPH:FIXME
	ret = !EXIT_SUCCESS;
	if (ret != EXIT_SUCCESS) {
		//delete file, so we don't leave partial file
		cf.Delete (filename, "");
		if (RequestCD () == -1)
			//NOTE LINK TO ABOVE IF
			Error ("Cannot load file <%s> from CD", filename);
		}
	} while (ret != EXIT_SUCCESS);
mb.Clear ();
return cfPiggy [gameStates.app.bD1Data].Open (filename, gameFolders.szDataDir, "rb", 0);
#endif
}
开发者ID:paud,项目名称:d2x-xl,代码行数:41,代码来源:piggy.cpp

示例2: Save

	void Save() const {
		CFile *pFile = new CFile(GetConfigPath());

		if (!pFile->Open(O_WRONLY | O_CREAT | O_TRUNC, 0600)) {
			DEBUG("ignore: Failed to save `" + GetConfigPath() + "` `" + CString(strerror(errno)) + "`");
			delete pFile;
			return;
		}

		for (vector<CIgnore>::const_iterator it = m_vIgnores.begin(); it != m_vIgnores.end(); ++it) {
			CIgnore Ignore = *it;

			pFile->Write(Ignore.ToString());
		}

		pFile->Sync();

		if (pFile->HadError()) {
			DEBUG("ignore: Failed to save `" + GetConfigPath() + "` `" + CString(strerror(errno)) + "`");
			pFile->Delete();
		}

		delete pFile;
	}
开发者ID:JeremiahDJordan,项目名称:znc-contrib,代码行数:24,代码来源:ignore.cpp

示例3: Load

bool CTriMeshBuilder::Load (int nLevel, bool bForce)
{
	CFile					cf;
	tMeshDataHeader	mdh;
	int					nSize;
	bool					bOk;
	char					szFilename [FILENAME_LEN];
	char					*ioBuffer = NULL, *bufP;

if (!(gameStates.render.bTriangleMesh && (gameStates.app.bCacheMeshes || bForce)))
	return false;
if (!cf.Open (DataFilename (szFilename, nLevel), gameFolders.szCacheDir, "rb", 0))
	return false;
bOk = (cf.Read (&mdh, sizeof (mdh), 1) == 1);
if (bOk)
	bOk = (mdh.nVersion == MESH_DATA_VERSION) &&
			(mdh.nSegments == gameData.segs.nSegments) &&
			(mdh.nFaces == gameData.segs.nFaces);
	uint	nTriVerts = mdh.nTris * 3;
if (bOk)
	nSize =
		(sizeof (gameData.segs.vertices [0]) + sizeof (gameData.segs.fVertices [0])) * mdh.nVertices +
		 sizeof (FACES.faces [0]) * mdh.nFaces +
		 sizeof (FACES.tris [0]) * mdh.nTris +
		(sizeof (FACES.vertices [0]) + sizeof (FACES.normals [0]) + sizeof (FACES.texCoord [0]) + 
		 sizeof (FACES.ovlTexCoord [0]) + sizeof (FACES.color [0]) + sizeof (FACES.lMapTexCoord [0])) * nTriVerts +
		 sizeof (FACES.faceVerts [0]) * mdh.nFaceVerts;
if (bOk)
	bOk = ((ioBuffer = new char [nSize]) != NULL);
if (bOk)
	bOk = cf.Read (ioBuffer, nSize, 1) == 1;
if (bOk) {
	bufP = ioBuffer;
	FACES.Destroy ();
	gameData.segs.vertices.Create (mdh.nVertices);
	memcpy (gameData.segs.vertices.Buffer (), bufP, nSize = sizeof (gameData.segs.vertices [0]) * mdh.nVertices);
	bufP += nSize;
	gameData.segs.fVertices.Create (mdh.nVertices);
	memcpy (gameData.segs.fVertices.Buffer (), bufP, nSize = sizeof (gameData.segs.fVertices [0]) * mdh.nVertices);
	bufP += nSize;
	FACES.faces.Create (mdh.nFaces);
	memcpy (FACES.faces.Buffer (), bufP, nSize = sizeof (FACES.faces [0]) * mdh.nFaces);
	bufP += nSize;
	FACES.tris.Create (mdh.nTris);
	memcpy (FACES.tris.Buffer (), bufP, nSize = sizeof (FACES.tris [0]) * mdh.nTris);
	bufP += nSize;
	FACES.vertices.Create (nTriVerts);
	memcpy (FACES.vertices.Buffer (), bufP, nSize = sizeof (FACES.vertices [0]) * nTriVerts);
	bufP += nSize;
	FACES.normals.Create (nTriVerts);
	memcpy (FACES.normals.Buffer (), bufP, nSize = sizeof (FACES.normals [0]) * nTriVerts);
	bufP += nSize;
	FACES.texCoord.Create (nTriVerts);
	memcpy (FACES.texCoord.Buffer (), bufP, nSize = sizeof (FACES.texCoord [0]) * nTriVerts);
	bufP += nSize;
	FACES.ovlTexCoord.Create (nTriVerts);
	memcpy (FACES.ovlTexCoord.Buffer (), bufP, nSize = sizeof (FACES.ovlTexCoord [0]) * nTriVerts);
	bufP += nSize;
	FACES.color.Create (nTriVerts);
	memcpy (FACES.color.Buffer (), bufP, nSize = sizeof (FACES.color [0]) * nTriVerts);
	bufP += nSize;
	FACES.lMapTexCoord.Create (nTriVerts);
	memcpy (FACES.lMapTexCoord.Buffer (), bufP, nSize = sizeof (FACES.lMapTexCoord [0]) * nTriVerts);
	bufP += nSize;
	FACES.faceVerts.Create (mdh.nFaceVerts);
	memcpy (FACES.faceVerts.Buffer (), bufP, nSize = sizeof (FACES.faceVerts [0]) * mdh.nFaceVerts);
	gameData.segs.points.Resize (mdh.nVertices);
	}
if (ioBuffer) {
	delete[] ioBuffer;
	ioBuffer = NULL;
	}
if (bOk) {
	gameData.segs.nVertices = mdh.nVertices;
	gameData.segs.nTris = mdh.nTris;
	SetupVertexNormals ();
	}
cf.Close ();
if (!gameStates.app.bCacheMeshes)
	cf.Delete (DataFilename (szFilename, nLevel), gameFolders.szCacheDir);
CreateSegFaceList ();
CreateFaceVertLists ();
return bOk;
}
开发者ID:paud,项目名称:d2x-xl,代码行数:84,代码来源:createmesh.cpp


注:本文中的CFile::Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。