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


C++ CFileStream::Create方法代码示例

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


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

示例1:

void CNumberFileStreamDlg::OnButton2() 
{
	char szPath[MAX_PATH];
	CFileStream fileStream;
	GetCurrentDirectory(sizeof(szPath),szPath);
	strcat(szPath,"\\moesky.dat");
	DeleteFile(szPath);
	if(fileStream.Create(szPath))
	{
		fileStream.AddFile("E:\\DRACU-RIOT!\\PSBReader_Sources\\NumberFileStream\\readme.bmp","/readme.bmp");
		fileStream.AddFile("E:\\DRACU-RIOT!\\exit_nomal.bmp","/exit_nomal.bmp");
		fileStream.AddFile("E:\\DRACU-RIOT!\\btl_未読文字btn_on副本1.bmp","/btl_未読文字btn_on.bmp");

		//
		//fileStream.AddFile("E:\\DRACU-RIOT!\\PSBReader_Sources\\Release\\title.psb\\src\\char\\ch_azusa.bmp","/ch_azusa.bmp");
		//fileStream.AddFile("E:\\DRACU-RIOT!\\PSBReader_Sources\\Release\\title.psb\\src\\char\\ch_bg.bmp","/ch_bg.bmp");
		//fileStream.AddFile("E:\\DRACU-RIOT!\\PSBReader_Sources\\Release\\title.psb\\src\\char\\ch_erina.bmp","/ch_erina.bmp");
		//fileStream.AddFile("E:\\DRACU-RIOT!\\PSBReader_Sources\\Release\\title.psb\\src\\char\\ch_heart.bmp","/ch_heart.bmp");
		//fileStream.AddFile("E:\\DRACU-RIOT!\\PSBReader_Sources\\Release\\title.psb\\src\\char\\ch_rio.bmp","/ch_rio.bmp");
		//fileStream.AddFile("E:\\DRACU-RIOT!\\PSBReader_Sources\\Release\\title.psb\\src\\char\\siromask.bmp","/siromask.bmp");
		if(fileStream.SaveToStream(TRUE))
		{
			::MessageBox(NULL,"保存文件流成功","",MB_OK);
		}
	}
}
开发者ID:AbyssSquall,项目名称:FuckGalEngine,代码行数:26,代码来源:NumberFileStreamDlg.cpp

示例2: _tmain


//.........这里部分代码省略.........
	if (!bDecompile)
	{
		// Load the input file
		CProfileFile file;
		for (int i=0; i<vecDefines.GetSize(); i++)
		{
			CUniString strName, strValue;
			SplitString(vecDefines[i], L"=", strName, strValue);
			wprintf(L"#define %s %s\n", strName, strValue);
			file.Define(strName, strValue);
		}

		if (!file.Load(strInputFile, &fp))
		{
			HRESULT hr=HRESULT_FROM_WIN32(GetLastError());
			wprintf(file.GetParseError());
			return 7;
		}

		// Extract encryption key
		DWORD dwEncryptionKey=0;
		CProfileSection* pSection=file.FindSection(L"Sinic");
		if (pSection)
		{
			// Save the key
			dwEncryptionKey=pSection->GetIntValue(L"EncryptionKey", 0);

			// Remove the "sinic" section
			file.Remove(pSection);
		}

		// Create output file
		CFileStream OutStream;
		if (!OutStream.Create(strOutputFile))
		{
			HRESULT hr=HRESULT_FROM_WIN32(GetLastError());
			wprintf(L"Failed to create '%s' - %s (0x%.8x)\n\n", strOutputFile, FormatError(hr), hr);
			return 7;
		}

		// Save as binary file
		HRESULT hr;
		if (dwEncryptionKey)
		{
			CAutoPtr<IStream, SRefCounted> spEncStream;
			CreateCryptorStream(&OutStream, CCryptorKey(dwEncryptionKey), &spEncStream);
			hr=SaveBinaryProfile(file, spEncStream);
		}
		else
		{
			hr=SaveBinaryProfile(file, &OutStream);
		}
		OutStream.Close();
		if (FAILED(hr))
		{
			HRESULT hr=HRESULT_FROM_WIN32(GetLastError());
			wprintf(L"Failed to save '%s' - %s (0x%.8x)\n\n", strOutputFile, FormatError(hr), hr);
			DeleteFile(strOutputFile);
			return 7;
		}
	}
	else
	{
		// Open stream
		CFileStream InStream;
		if (!InStream.Open(strInputFile))
开发者ID:adhawkins,项目名称:SimpleLib,代码行数:67,代码来源:Sinic.cpp


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