ホーム » 2017 » 6月 » 06

日別アーカイブ: 2017/06/06

2017年6月
 123
45678910
11121314151617
18192021222324
252627282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,349 アクセス



DS115j std::tostringstream

DS115j で,次の様なコードの str が “123” にならない(”0″ になる).


 {
   double checkValue = 123 ;
   tstring str ;
   std::tostringstream strBuf ;
   {
     strBuf << checkValue ;
     str = strBuf.str() ;
     }
   // …
   }


sprintf を利用することで対応.
 {
   std::string str ;
   tstring fmt = _T(“%.”) + ::To_tstring(p) + _T(“f”) ;
   str.resize(512,0) ;
   sprintf(&str[0],fmt.c_str(),v) ;
   // …
   }

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.