stl字符串使用

    技术2022-05-20  43

    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可以实现,记录下来。

     

     


    最新回复(0)