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


C++ tstring::rfind方法代码示例

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


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

示例1: save_url

bool save_url(HANDLE hNetlib,const std::string &url,const std::tstring &filename)
{
	NETLIBHTTPREQUEST req = {sizeof(req)};
	req.requestType = REQUEST_GET;
	req.flags = NLHRF_HTTP11 | NLHRF_REDIRECT;
	req.szUrl = const_cast<char*>(url.c_str());

	NETLIBHTTPREQUEST *resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
		reinterpret_cast<WPARAM>(hNetlib), reinterpret_cast<LPARAM>(&req)));

	if (resp)
	{
		bool success = (resp->resultCode == 200);
		if (success)
		{
			// Create folder if necessary
			std::tstring dir = filename.substr(0,filename.rfind('\\'));
			if( _taccess(dir.c_str(),0))
				CreateDirectoryTreeT(dir.c_str());

			// Write to file
			FILE *f = _tfopen(filename.c_str(), _T("wb"));
			fwrite(resp->pData,1,resp->dataLength,f);
			fclose(f);
		}

		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)resp);
		return success;
	}
	else
		return false;
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:32,代码来源:utility.cpp

示例2: GetFileExtension

std::tstring GetFileExtension(const std::tstring& fileName)
{
    size_t extensionPosition = fileName.rfind(_T('.'));	
    if(0 < extensionPosition)
        return fileName.substr(extensionPosition + 1);

    return _T("");
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:ExtractEmail.cpp

示例3: GetFilenameWithoutExtension

std::tstring GetFilenameWithoutExtension(const std::tstring& fileName)
{
    size_t extensionPosition = fileName.rfind(_T('.'));	
    if(0 < extensionPosition)
        return fileName.substr(0, extensionPosition);

    return fileName;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:ExtractEmail.cpp

示例4: save_url

bool facebook_client::save_url(const std::string &url,const std::tstring &filename, HANDLE &nlc)
{
	NETLIBHTTPREQUEST req = {sizeof(req)};
	NETLIBHTTPREQUEST *resp;
	req.requestType = REQUEST_GET;
	req.szUrl = const_cast<char*>(url.c_str());
	req.flags = NLHRF_HTTP11 | NLHRF_REDIRECT | NLHRF_PERSISTENT | NLHRF_NODUMP;
	req.nlc = nlc;

	resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
		reinterpret_cast<WPARAM>(this->parent->m_hNetlibUser), reinterpret_cast<LPARAM>(&req)));

	bool ret = false;

	if (resp) {
		nlc = resp->nlc;
		parent->debugLogA("@@@@@ Saving avatar URL %s to path %s", url.c_str(), _T2A(filename.c_str()));

		// Create folder if necessary
		std::tstring dir = filename.substr(0,filename.rfind('\\'));
		if (_taccess(dir.c_str(), 0))
			CreateDirectoryTreeT(dir.c_str());

		// Write to file
		FILE *f = _tfopen(filename.c_str(), _T("wb"));
		if (f != NULL) {
			fwrite(resp->pData,1,resp->dataLength,f);
			fclose(f);

			ret = _taccess(filename.c_str(), 0) == 0;
		}

		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
	} else {
		nlc = NULL;
	}

	return ret;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:39,代码来源:communication.cpp


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