它嚇壞了我,我無法找到將浮點數轉換爲wchar_t或者我正在尋找錯誤的地方!cast float to wchar_t win32
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的將其發送到列表框中
用VS2012還可以使用'的std :: to_wstring(X)'轉換爲'wstring'。 – 2013-02-17 22:17:14
[你可以使用什麼將一個int/float轉換爲wchar \ _t \ *?](http://stackoverflow.com/questions/1860945/what-can-you-use-to-cast-an -int-float到一個-WCHAR-T) – Deanna 2013-02-19 14:24:17