让我感到害怕的是,无论如何我都找不到将 float 转换为 wchar_t 的方法,或者我可能找错了地方!
float cNumbers[9] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0};
float x = 3.0;
float temp = 0.0;
wchar_t data[] = {0};
for(int i=0; i < sizeof(cNumbers); i++){
temp = x / cNumbers[i];
bool isInt = temp == static_cast<int>(temp);
if(isInt){
data = temp; //this is a big fail
addToList(hWnd,data);
}
}
void addToList(HWND hWnd,const wchar_t * data ){
SendMessage(GetDlgItem(hWnd,IDC_LISTBOX),LB_ADDSTRING,0,(LPARAM)data);
}
问题是我想将浮点值转换为 wchar_t 以将其发送到列表框