私は C++ が初めてで、コードの一部に苦労しています。ボタンのクリックで更新したいダイアログに静的テキストがあります。
double num = 4.7;
std::string str = (boost::lexical_cast<std::string>(num));
test.SetWindowTextA(str.c_str());
//test is the Static text variable
ただし、テキストは 4.70000000000002 として表示されます。4.7のように見せるにはどうすればよいですか。
.c_str()
そうしないとcannot convert parameter 1 from 'std::string' to 'LPCTSTR'
エラーがスローされるため、使用しました。