Is there an equivalent function to atof but that can handle Unicode or WCHAR. I searched the forum, but couldn't find anything.
Thanks.
Thanks.
A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.
float size_x;
char *pmbbuf = (char *)malloc(100);
int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_SIZE_X));
if(len > 0)
{
int i;
WCHAR* buf;
buf = (WCHAR*)GlobalAlloc(GPTR, len + 1);
wcstombs(pmbbuf,GetDlgItemText(hwnd, IDC_SIZE_X, buf, len + 1), 100);
size_x=atof(pmbbuf);
GlobalFree(HANDLE)buf);
}
wcstombs(pmbbuf,GetDlgItemText(hwnd, IDC_SIZE_X, buf, len + 1), 100);
float size_x;
char *pmbbuf = (char *)malloc(100);
int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_SIZE_X));
if(len > 0)
{
char *pmbbuf = (char *)malloc(100);
WCHAR* buf;
buf = (WCHAR*)GlobalAlloc(GPTR, len + 1 * sizeof(WCHAR));
GetDlgItemText(hwnd, IDC_SIZE_X, buf, len + 1);
wcstombs(pmbbuf, buf, 100);
size_x=atof(pmbbuf);
GlobalFree(HANDLE)buf);
}
float size_x;
char sBuf[100];
WCHAR swBuf[100];
if (GetDlgItemText(hwnd, IDC_SIZE_X, swBuf, sizeof(swBuf)/sizeof(WCHAR))) {
wcstombs(sBuf, swBuf, sizeof(sBuf));
size_x=atof(sBuf);
} else
size_x=0; //Default value if edit box is empty
float size_x;
WCHAR swBuf[100];
if (GetDlgItemText(hwnd, IDC_SIZE_X, swBuf, sizeof(swBuf)/sizeof(WCHAR)))
size_x=_wtof(swBuf);
else
size_x=0; //Default value if edit box is empty