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


C++ string::c_str方法代码示例

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


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

示例1: changeWorkingDirectoryTo

//! Changes the current Working Directory to the given string.
bool CFileSystem::changeWorkingDirectoryTo(const core::string<c16>& newDirectory)
{
	bool success=false;

	if (FileSystemType != FILESYSTEM_NATIVE)
	{
		WorkingDirectory[FILESYSTEM_VIRTUAL].append(newDirectory);
		flattenFilename(WorkingDirectory[FILESYSTEM_VIRTUAL], "");
		success = 1;
	}
	else
	{
		WorkingDirectory[FILESYSTEM_NATIVE] = newDirectory;

#if defined(_IRR_USE_WINDOWS_CE_DEVICE_)
		success = true;
#elif defined(_MSC_VER)
	#if defined(_IRR_WCHAR_FILESYSTEM)
		success=(_wchdir(newDirectory.c_str()) == 0);
	#else
		success=(_chdir(newDirectory.c_str()) == 0);
	#endif
#else
		success=(chdir(newDirectory.c_str()) == 0);
#endif
	}

	return success;
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:30,代码来源:CFileSystem.cpp

示例2: getZzipError

const mchar* getZzipError(zzip_error_t zzipError) 
{
	static core::string errorMsg;
    switch (zzipError)
    {
    case ZZIP_NO_ERROR:
        break;
    case ZZIP_OUTOFMEM:
        errorMsg = mT("Out of memory.");
        break;            
    case ZZIP_DIR_OPEN:
    case ZZIP_DIR_STAT: 
    case ZZIP_DIR_SEEK:
    case ZZIP_DIR_READ:
        errorMsg = mT("Unable to read zip file.");
        break;            
    case ZZIP_UNSUPP_COMPR:
        errorMsg = mT("Unsupported compression format.");
        break;            
    case ZZIP_CORRUPTED:
        errorMsg = mT("Corrupted archive.");
        break;            
    default:
        errorMsg = mT("Unknown error.");
        break;            
    };

    return errorMsg.c_str();
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:29,代码来源:CZipArchive.cpp

示例3: OpenByName

bool OFSerialPort::OpenByName(const core::string& port,int baudRate)
{
	if(m_open)
		Close();
	m_open=m_sp->setup(port.c_str(),baudRate);
	return m_open;
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:7,代码来源:OFSerialPort.cpp

示例4: prevValue

core::string AlphabetFlow::prevValue(const core::string & value)
{
    char *ret = alphabetflow_prev(value.c_str(), (uint)value.length());
    core::string str = ret;
    free(ret);
    return str;   
}
开发者ID:imace,项目名称:nnt,代码行数:7,代码来源:AlphabetFlow.cpp

示例5: re_key

void Sqlite::re_key(core::string const& key)
{
    if (key.length())
        sqlite3_rekey(d_ptr->db, key.c_str(), key.length());
    else
        sqlite3_rekey(d_ptr->db, NULL, 0);
}
开发者ID:imace,项目名称:nnt,代码行数:7,代码来源:Sqlite+NNT.cpp

示例6: open

bool open(core::string const& file)
{
    this->close();
    
    fd.open(file.c_str(), ::std::ios_base::app | ::std::ios_base::out);
    if (!fd.is_open())
        return false;
    
    // open.
    appender = new log4cpp::OstreamAppender(file.c_str(), &fd);        
    log4cpp::PatternLayout* layout = new log4cpp::PatternLayout;
    layout->setConversionPattern("%d: %p %c %x: %m%n");
    appender->setLayout(layout);
    category->addAppender(appender);
    
    return true;
}
开发者ID:imace,项目名称:nnt,代码行数:17,代码来源:Logger+NNT.cpp

示例7: existFile

//! determines if a file exists and would be able to be opened.
bool CFileSystem::existFile(const core::string<c16>& filename) const
{
	for (u32 i=0; i < FileArchives.size(); ++i)
		if ( FileArchives[i]->findFile(filename)!=-1)
			return true;

#if defined ( _IRR_WCHAR_FILESYSTEM )
	FILE* f = _wfopen(filename.c_str(), L"rb");
#else
	FILE* f = fopen(filename.c_str(), "rb");
#endif

	if (f)
	{
		fclose(f);
		return true;
	}

	_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
	return false;
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:22,代码来源:CFileSystem.cpp

示例8: defined

core::string<c16> CFileSystem::getAbsolutePath(const core::string<c16>& filename) const
{
	c16 *p=0;

#if defined(_IRR_USE_WINDOWS_CE_DEVICE_)
	return filename;
#elif defined(_IRR_WINDOWS_API_)

	#if defined(_IRR_WCHAR_FILESYSTEM )
		c16 fpath[_MAX_PATH];
		p = _wfullpath(fpath, filename.c_str(), _MAX_PATH);
	#else
		c8 fpath[_MAX_PATH];
		p = _fullpath(fpath, filename.c_str(), _MAX_PATH);
	#endif

#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
	c8 fpath[4096];
	fpath[0]=0;
	p = realpath(filename.c_str(), fpath);
	if (!p)
	{
		// content in fpath is undefined at this point
		if ('0'==fpath[0]) // seems like fpath wasn't altered
		{
			// at least remove a ./ prefix
			if ('.'==filename[0] && '/'==filename[1])
				return filename.subString(2, filename.size()-2);
			else
				return filename;
		}
		else
			return core::string<c16>(fpath);
	}

#endif

	return core::string<c16>(p);
}
开发者ID:harmboschloo,项目名称:CocaProject,代码行数:39,代码来源:CFileSystem.cpp

示例9: setPipelineWithSink

bool ofGstUtils::setPipelineWithSink(const core::string &pipeline, const core::string & sinkname, bool isStream){
	ofGstUtils::startGstMainLoop();

	gchar* pipeline_string =
		g_strdup((pipeline).c_str());

	GError * error = NULL;
	gstPipeline = gst_parse_launch (pipeline_string, &error);

	gLogManager.log( core::string("gstreamer pipeline: ")+ pipeline_string,ELL_INFO);
	if(error!=NULL){
		gLogManager.log(core::string("couldnt create pipeline: ") + error->message,ELL_WARNING);
		return false;
	}

	gstSink = gst_bin_get_by_name(GST_BIN(gstPipeline),sinkname.c_str());

	if(!gstSink){
		gLogManager.log( "couldn't get sink from string pipeline",ELL_WARNING);
	}

	return setPipelineWithSink(gstPipeline,gstSink,isStream);
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:23,代码来源:ofGstUtils.cpp

示例10:

sel::selector luaengine::operator [] (const core::string & variable)
{
	return _state[variable.c_str()];
}
开发者ID:Botyto,项目名称:Core,代码行数:4,代码来源:engine.cpp

示例11: re

core::data md5::hex(core::string const& str)
{
    core::data re(MD5_DIGEST_LENGTH);
    MD5((byte*)str.c_str(), str.length(), core::pointer(re));
    return re;
}
开发者ID:imace,项目名称:nnt,代码行数:6,代码来源:MDN+NNT.cpp

示例12: getMessage

const mchar* getMessage(int msgCode){

	static core::string msgStr;
	switch(msgCode){
		case HMSG_NET_START:
			msgStr+=mT("Network startup.");
			break;
		case HMSG_SOCKET_OPEN:
			msgStr+=mT("Socket Open.");
			break;
		case HMSG_TCP_SOCKET_CREATE:
			msgStr+=mT("TCP Socket Create.");
			break;
		case HMSG_UDP_SOCKET_CREATE:
			msgStr+=mT("UDP Socket Create.");
			break;
		case HMSG_GETHOST:
			msgStr+=mT("Get Host Name.");
			break;
		case HMSG_BIND:
			msgStr+=mT("socket Bind.");
			break;
		case HMSG_GETSOCKNAME:
			msgStr+=mT("Getting socket name.");
			break;
		case HMSG_ACCEPT:
			msgStr+=mT("accept data.");
			break;
		case HMSG_LISTEN:
			msgStr+=mT("Socket Listning.");
			break;
		case HMSG_FIND_REMOTE_HOST:
			msgStr+=mT("Find Remote Host.");
			break;
		case HMSG_CREATE_CONNECTION:
			msgStr+=mT("Creating Connection to Remote Host.");
			break;
		case HMSG_SEND:
			msgStr+=mT("Send Data.");
			break;
		case HMSG_RECIVE:
			msgStr+=mT("Recive Data.");
			break;
		case HMSG_SERVER_LOST:
			msgStr+=mT("Server Lost.");
			break;
		case HMSG_CANOT_CONNECT:
			msgStr+=mT("Cann't connect to server.");
			break;
		case HMSG_MAX_CLIENTS:
			msgStr+=mT("Max Clients Reached.");
			break;
		case HMSG_CLIENT_LOST:
			msgStr+=mT("Client Lost.");
			break;
		case HMSG_SETBROADCAST:
			msgStr+=mT("set Broadcast.");
			break;
		case HMSG_BROADCAST:
			msgStr+=mT("Broadcasting!.");
			break;
		case HMSG_TIMEOUT:
			msgStr+=mT("timeout!.");
			break;
		case HMSG_UNREACHABLEHOST:
			msgStr+=mT("Unreachable remote host!.");
			break;

		default:
			msgStr+=mT("Unkwon.");
			break;
	}


	return msgStr.c_str();
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:76,代码来源:HMessage.cpp

示例13: NavigateToUrl

bool BrowserWindow::NavigateToUrl(const core::string& url)
{
	return m_impl->GetWindow()->navigateTo(url.c_str(),url.length());
}
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:4,代码来源:BrowserWindow.cpp

示例14: set_key

void Sqlite::set_key(core::string const& key)
{
    sqlite3_key(d_ptr->db, key.c_str(), key.length());
}
开发者ID:imace,项目名称:nnt,代码行数:4,代码来源:Sqlite+NNT.cpp

示例15:

Error::Error(const core::string& message)
	: std::runtime_error(message.c_str())
{
}
开发者ID:YosukeM,项目名称:Birth,代码行数:4,代码来源:Error.cpp


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