现在的位置: 首页 > 综合 > 正文

stl字符串使用

2013年08月31日 ⁄ 综合 ⁄ 共 762字 ⁄ 字号 评论关闭

std::ostringstream   ostr;   //   include   <sstream>  
 ostr   <<   "targetBox.m_vMax("   <<   targetBox.m_vMax.x  ;
 ostr   <<   ","   <<   targetBox.m_vMax.y  ;
 ostr   <<   ","   <<   targetBox.m_vMax.z  ;
 ostr   << ")";

 ostr   <<   "targetBox.m_vMin("   <<   targetBox.m_vMin.x  ;
 ostr   <<   ","   <<   targetBox.m_vMin.y  ;
 ostr   <<   ","   <<   targetBox.m_vMin.z  ;
 ostr   << ")";

 ostr   <<   "m_vMax("   <<   m_vMax.x  ;
 ostr   <<   ","   <<   m_vMax.y  ;
 ostr   <<   ","   <<   m_vMax.z  ;
 ostr   << ")";

 ostr   <<   "m_vMin("   <<   m_vMin.x  ;
 ostr   <<   ","   <<   m_vMin.y  ;
 ostr   <<   ","   <<   m_vMin.z  ;
 ostr   << ")";

 //std::cout   <<   ostr.str().c_str()   <<   std::endl;

 std::string s = ostr.str();
 Logs::LogsWrite((TCHAR*)s.c_str(),"testCollionTest.txt");

 

离开了MFC一下子连怎么拼接字符串都不会了,从网上查到了用std::ostringstream可以实现,记录下来。

 

 

抱歉!评论已关闭.