將long數據存到字符串中並格式化字符串數組


//將long數據存到字符串中並格式化字符串數組

PTSTR BigNumToString(LONG lNum, PTSTR szBuf, DWORD chBufSize) {

   TCHAR szNum[100];

   StringCchPrintf(szNum, _countof(szNum), TEXT("%d"), lNum);

  //This structure contains information that defines the format of a number string. 

  //The GetNumberFormat function uses this information to customize a number          //string for a specified locale.

   NUMBERFMT nf;
   nf.NumDigits = 0;
   nf.LeadingZero = FALSE;
   nf.Grouping = 3;
   nf.lpDecimalSep = TEXT(".");
   nf.lpThousandSep = TEXT(",");
   nf.NegativeOrder = 0;
   GetNumberFormat(LOCALE_USER_DEFAULT, 0, szNum, &nf, szBuf, chBufSize);
   return(szBuf);
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章