Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

GetNumberFormat returning special character instead of minus sign for negative Value

$
0
0

Hi ,

I am trying to use GetNumberFormat for negative values in Win CE 6.

In trying to do so, I get some special character as a output instead of the minus sign.

This problem does not happen in the Win32 version of the API but happens only in the Win CE 6.

   

Code Snippet:

CStringm_csDecimalSep;
static const int MAX_DECIMAL_SEP = 10;
LPCWSTR str = L"-1.1";
NUMBERFMT m_nf;

m_nf.lpThousandSep = L"";
m_nf.NegativeOrder =1; // 1 = Negative sign, number; for example, -1.1
 m_nf.LeadingZero = TRUE;

       WCHAR buf[50];
*buf = 0;
GetLocaleInfo( GetUserDefaultLCID(), LOCALE_SDECIMAL, m_csDecimalSep.GetBuffer(MAX_DECIMAL_SEP),                     MAX_DECIMAL_SEP );
m_nf.lpDecimalSep = (LPWSTR) (LPCWSTR) m_csDecimalSep;
GetNumberFormat(GetUserDefaultLCID(),0,str,&m_nf,buf, sizeof(buf)/sizeof(buf[0]));

Now, after the GetNumberFormat is returned, Buf contains some special character and then 1 instead of -1.

I am pretty sure there is nothing wrong with the code that I am using as I have even specified negative order to 1.

So, please let me know how to solve this problem.

Thanks! 


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>