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


C++ EMUFILE::fprintf方法代码示例

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


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

示例1: flush

void BackupDevice::flush()
{
	//never use save files if we are in movie mode
	if(isMovieMode) return;

	if (filename.length() == 0) return;

	EMUFILE* outf = new EMUFILE_FILE(filename.c_str(),"wb");
	if(!outf->fail())
	{
		if(data.size()>0)
			outf->fwrite(&data[0],data.size());
		
		//write the footer. we use a footer so that we can maximize the chance of the
		//save file being recognized as a raw save file by other emulators etc.
		
		//first, pad up to the next largest known save size.
		u32 size = data.size();
		u32 padSize = pad_up_size(size);

		for(u32 i=size;i<padSize;i++)
			outf->fputc(kUninitializedSaveDataValue);

		//this is just for humans to read
		outf->fprintf("|<--Snip above here to create a raw sav by excluding this DeSmuME savedata footer:");

		//and now the actual footer
		write32le(size,outf); //the size of data that has actually been written
		write32le(padSize,outf); //the size we padded it to
		write32le(info.type,outf); //save memory type
		write32le(addr_size,outf);
		write32le(info.size,outf); //save memory size
		write32le(0,outf); //version number
		outf->fprintf("%s", kDesmumeSaveCookie); //this is what we'll use to recognize the desmume format save

		delete outf;
	}
	else
	{
		delete outf;
		printf("Unable to open savefile %s\n", filename.c_str());
	}
}
开发者ID:emmasteimann,项目名称:nds4droid,代码行数:43,代码来源:mc.cpp


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