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


C++ CStdStringA::Format方法代码示例

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


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

示例1: RegisterItem

bool DotNetRegistrar::RegisterItem()
{
	CStdString sFileName;
	CStdString sParams;
	CreateRegisterCommandString(sFileName, sParams);

	if(_taccess(GetNameOfErrorLogFile().c_str(), 00) == 0)
		_tremove(GetNameOfErrorLogFile().c_str());

    CFilePath exePath( GetDotNetRegistrationFileName() ); //this was retrieved in CreateRegisterCommandString, but we want one without enclosing quotes
    CStdStringA sCommand ;
    sCommand.Format("\"%s\" %s", CStdStringA(exePath.GetFileName()), CStdStringA( sParams ) );

    //Batch file will contain just the executable name, not path. Working directory is assumed 
    //by ExecuteAndWait to be the execution directory.

    CStdString sBatchFile = GetExecutionPath() + _T("\\Register.bat");
    _tremove( sBatchFile.c_str());
    CreateTextFile( sBatchFile, sCommand );
    ASSERT( CGeneral::FileExists( sBatchFile ));
	ExecuteAndWait(sBatchFile, _T(""));
    _tremove( sBatchFile.c_str());
    
	if (ErrorOccurred())
	{
		std::vector<CStdString> Errors = GetErrorsFromFile();
		std::vector<CStdString>::iterator it;
		for(it = Errors.begin(); it != Errors.end(); ++it)
		{
			ReportEvent(EVENTLOG_ERROR_TYPE, 0, *it);
		}
		return false;
	}
	return true;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:35,代码来源:DotNetRegistrar.cpp

示例2: LoadDll

void ActivationContextLoader::LoadDll()
{
    // Get a handle to the DLL module.
 
	CPath dllPath;
	dllPath.Combine(GetModulePath(), WS_ACTIVATIONCONTEXTLOADER_DLL);
	
    m_hinstLib = LoadLibrary(dllPath); 
 
    // If the handle is valid, try to get the function address.
 
    if (m_hinstLib != NULL) 
    { 
		m_funcLAC = (LAC) GetProcAddress(m_hinstLib, WS_ACLOADFUNC); 
													 
		m_funcULAC = (ULAC) GetProcAddress(m_hinstLib, WS_ACUNLOADFUNC);

		m_funcIAAFM = (IAAFM) GetProcAddress(m_hinstLib, WS_ACALREADYACTIVEFUNC);
    } 
	else
	{
		CStdStringA msg;
		msg.Format("LoadLibrary on '%s'failed. Error code: %d.", WS_ACTIVATIONCONTEXTLOADER_DLL_A, GetLastError());
		throw std::exception(msg);
	}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:26,代码来源:ActivationContextLoader.cpp

示例3: RTFfield

DocFileField::DocFileField(const WrdCharacterProperties& props, WordParserInfo& wpi) : RTFfield(wpi.GetFileContext())
{
    the_RTFFieldInst = new RTFfldinst(m_pContext);

    CStdStringA sFont = wpi.m_FontTable.getFontFamilyName(props.getFontIndexForSymbol()).getFaceName().c_str();

    if ((int)sFont.find(" ") > 0)
    {
        sFont = "\"" + sFont + "\"";
    }

    CStdStringA sInst;
    if (1 & props.getFontSize())
        sInst.Format("SYMBOL %d \\f %s \\s %.1f", props.getSymbolCharacter() & 0xFF, sFont.c_str(), ((double)props.getFontSize())/2);
    else
        sInst.Format("SYMBOL %d \\f %s \\s %d", props.getSymbolCharacter() & 0xFF, sFont.c_str(), props.getFontSize()/2);
    the_RTFFieldInst->AddObject(new DocFilePCData(m_pContext, sInst));

    CreateResult();
    // the_RTFFieldResult->AddObject( new DocFileChrfmt(props , wpi, false) );//TODO - need a double check
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:21,代码来源:DocFileField.cpp

示例4: UnloadDll

void ActivationContextLoader::UnloadDll()
{
	if(m_hinstLib)
	{
		if (FALSE == FreeLibrary(m_hinstLib))
		{
			CStdStringA msg;
			msg.Format("FreeLibrary on '%s'failed. Error code: %d.", WS_ACTIVATIONCONTEXTLOADER_DLL_A, GetLastError());
			throw std::exception(msg);
		}
	}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:12,代码来源:ActivationContextLoader.cpp

示例5: DebugDumpStructureToFile

void CRTFTablePostProcessor::DebugDumpStructureToFile(int iSuffix, LPCSTR szContext)
{
	if (m_prtfFile->GetModality() == 0) 
		return;
	CStdStringA csFileName;
	csFileName.Format("c:\\BHTableDump%d%c.txt",iSuffix, m_prtfFile->GetModality() == 1 ? 'O' : 'M');
	if(FILE *fp = fopen(csFileName, "w"))
	{
		fprintf( fp, "%s - Starting at %d\n", szContext, m_iStart);
		m_pParentCollection->Dump(fp, true);
		fclose(fp);
	}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:13,代码来源:RTFTablePostProcessor.cpp

示例6: UnloadAC

void ActivationContextLoader::UnloadAC()
{
	if (m_funcULAC && m_cookie != 0)
	{
		DWORD dwRet = (m_funcULAC)(m_cookie); 
		if (ERROR_SUCCESS != dwRet)
		{
			CStdStringA msg;
			msg.Format("Unloading Activation Context failed. Error code: %d", dwRet);
			throw std::exception(msg);
		}
	}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:13,代码来源:ActivationContextLoader.cpp

示例7: LoadAC

void ActivationContextLoader::LoadAC()
{
	if (m_funcLAC)
	{
		DWORD dwRet = (m_funcLAC)(m_sManifest, &m_cookie);
		if (ERROR_SUCCESS != dwRet)
		{
			CStdStringA msg;
			msg.Format("Loading Activation Context with manifest '%s' failed. Error code: %d", m_sManifest.c_str(), dwRet);
			throw std::exception(msg);
		}
	}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:13,代码来源:ActivationContextLoader.cpp

示例8: CopyTestFileToTempFile

CStdString CTestUtils::CopyTestFileToTempFile(const CStdString& sSource)
{
	if(_taccess(sSource, 0) != 0)
	{
		CStdStringA sError;
		sError.Format("CTestUtils::CopyTestFileToTempFile - source file (%s) doesn't exist.", sSource.c_str());
		throw std::exception(sError.c_str());
	}

	TCHAR szTempPath[ MAX_PATH ] = {0};
	::GetTempPath( MAX_PATH, szTempPath );
	TCHAR szTempFileName[MAX_PATH] = {0};
	::GetTempFileName( szTempPath, _T( "wst" ), 0, szTempFileName );

	if (!CopyFile(sSource.c_str(), szTempFileName, false))
	{
		CStdStringA sError;
		sError.Format("CTestUtils::CopyTestFileToTempFile copy file failed - source file (%s) destination file (%s)", sSource.c_str(), szTempFileName);
		throw std::exception(sError.c_str());
	}
	return CStdString(szTempFileName);

}
开发者ID:killbug2004,项目名称:WSProf,代码行数:23,代码来源:TestUtils.cpp

示例9: UnregisterItem

bool DotNetRegistrar::UnregisterItem()
{
	CStdString sFileName;
	CStdString sParams;
	CreateUnregisterCommandString(sFileName, sParams);

    CFilePath exePath( GetDotNetRegistrationFileName() ); //this was retrieved in CreateRegisterCommandString, but we want one without enclosing quotes
    CStdStringA sCommand ;
    sCommand.Format("\"%s\" %s", CStdStringA(exePath.GetFileName()), CStdStringA( sParams ) );

    CStdString sBatchFile = GetExecutionPath() + _T("\\Register.bat");
    _tremove( sBatchFile.c_str());
    CreateTextFile( sBatchFile, sCommand );
    ASSERT( CGeneral::FileExists( sBatchFile ));
	
    bool res = true;
    try
    {
	    CStdString cmdLine = sBatchFile;
	    STARTUPINFO si;
	    PROCESS_INFORMATION pi;
	    ZeroMemory(&si, sizeof(si));
	    si.cb = sizeof(si);
	    si.wShowWindow = SW_HIDE;
	    ZeroMemory(&pi, sizeof(pi));
	    if ( !CreateProcess( NULL, cmdLine.GetBuffer(MAX_PATH), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) )
	    {
		    cmdLine.ReleaseBuffer();
		    res = false;

	    }
	    cmdLine.ReleaseBuffer();	
	    if ( res )
	    {
		    // Wait around for 15 seconds 
		    WaitForSingleObject(pi.hProcess, 15000);
		    CloseHandle(pi.hProcess);
		    CloseHandle(pi.hThread);
	    }
    }
    catch(...)
    {
        _tremove( sBatchFile.c_str());
        throw;
    }

    _tremove( sBatchFile.c_str());
	return res;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:49,代码来源:DotNetRegistrar.cpp

示例10: ProcessCommand


//.........这里部分代码省略.........
				CStdString const adminIpBindings = m_pOptions->GetOption(OPTION_ADMINIPBINDINGS);

				CStdString peerIP;
				UINT port = 0;
				bool bLocal = false;
				if (!pAdminSocket->GetPeerName(peerIP, port))
					return FALSE;
				else
					bLocal = IsLocalhost(peerIP);

				if (!m_pOptions->ParseOptionsCommand(pData, nDataLength, bLocal)) {
					pAdminSocket->SendCommand(1, 1, "\001Protocol error: Invalid data, could not import settings.", strlen("\001Protocol error: Invalid data, could not import settings.")+1);
					char buffer = 1;
					pAdminSocket->SendCommand(1, 5, &buffer, 1);
					break;
				}

				char buffer = 0;
				pAdminSocket->SendCommand(1, 5, &buffer, 1);

				unsigned int threadnum = (int)m_pOptions->GetOptionVal(OPTION_THREADNUM);
				if (m_nServerState & STATE_ONLINE) {
					if (threadnum > m_ThreadArray.size()) {
						while (threadnum > m_ThreadArray.size()) {
							int index = GetNextThreadNotificationID();
							CServerThread *pThread = new CServerThread(WM_FILEZILLA_SERVERMSG + index);
							m_ThreadNotificationIDs[index] = pThread;
							if (pThread->Create(THREAD_PRIORITY_NORMAL, CREATE_SUSPENDED)) {
								pThread->ResumeThread();
								m_ThreadArray.push_back(pThread);
							}
						}
						CStdString str;
						str.Format(_T("Number of threads increased to %d."), threadnum);
						ShowStatus(str, 0);
					}
					else if (threadnum < m_ThreadArray.size()) {
						CStdString str;
						str.Format(_T("Decreasing number of threads to %d."), threadnum);
						ShowStatus(str, 0);
						unsigned int i = 0;
						std::vector<CServerThread *> newList;
						for (auto iter = m_ThreadArray.begin(); iter != m_ThreadArray.end(); iter++, i++) {
							if (i >= threadnum) {
								(*iter)->PostThreadMessage(WM_FILEZILLA_THREADMSG, FTM_GOOFFLINE, 2);
								m_ClosedThreads.push_back(*iter);
							}
							else
								newList.push_back(*iter);
						}
						m_ThreadArray.swap(newList);
					}
				}
				if (listenPorts != m_pOptions->GetOption(OPTION_SERVERPORT) ||
					enableSsl != (m_pOptions->GetOptionVal(OPTION_ENABLETLS) != 0) ||
					(m_pOptions->GetOptionVal(OPTION_ENABLETLS) && listenPortsSsl != m_pOptions->GetOption(OPTION_TLSPORTS)) ||
					ipBindings != m_pOptions->GetOption(OPTION_IPBINDINGS))
				{
					if (!m_ListenSocketList.empty()) {
						ShowStatus(_T("Closing all listening sockets"), 0);
						for (std::list<CListenSocket*>::iterator listIter = m_ListenSocketList.begin(); listIter != m_ListenSocketList.end(); ++listIter) {
							(*listIter)->Close();
							delete *listIter;
						}
						m_ListenSocketList.clear();
开发者ID:soulic,项目名称:FileZilla-Server,代码行数:66,代码来源:Server.cpp


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