I try to format decimal numbers using GetNumberFormat but the function always returns 0 => Error 87.
static NUMBERFMTW NumberFormat = {3,1,3,L".",L" ",3} ;
LPSTR FormatNumberEx(LPSTR __lpszValue,LPSTR __lpszNumberStr,int __cchNumber)
{
wchar_t _szLocaleName[LOCALE_NAME_MAX_LENGTH] ;
wchar_t _szWideChar[512] ;
wchar_t _szOutput[512] ;
MultiByteToWideChar(CP_UTF8,MB_PRECOMPOSED,__lpszValue,-1,_szWideChar,sizeof(_szWideChar)*sizeof(TCHAR)) ;
GetNumberFormatEx(LOCALE_NAME_USER_DEFAULT,0,_szWideChar,&NumberFormat,_szOutput,512) ;
GetLastError() ;
WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK,_szOutput,-1,__lpszNumberStr,__cchNumber,NULL,NULL) ;
return (__lpszNumberStr) ;
}
Could you help me?
Thanks