开发者

using _wtol to convert with decimals

开发者 https://www.devze.com 2023-03-03 09:57 出处:网络
The function _wtol converts from a wide character string to a long. The problem is that it doesn\'t convert with decimals. I don\'开发者_如何转开发t know enough c++ to come up with a workaround, so ca

The function _wtol converts from a wide character string to a long. The problem is that it doesn't convert with decimals. I don'开发者_如何转开发t know enough c++ to come up with a workaround, so can someone suggest a workaround or an alternate conversion function that does convert with the decimal?

Thx

void button_click(void) {

Edit_LimitText(edithwnd, 100); // edithwnd is a global hwnd
wchar_t editxt[100];
GetWindowText(edithwnd, editxt, 100); // say I typed 36.56 in the edit control
long lng = _wtol(editxt); // when I pause during debug and look at my locals, lng would equal 36, but I need it to equal 36.56
}


_wtof(), et al. See here.

0

精彩评论

暂无评论...
验证码 换一张
取 消