AdoDef.cpp 785 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "stdafx.h"
  2. #include "AdoDef.h"
  3. CString IntToStr(int nVal)
  4. {
  5. CString strRet;
  6. char buff[10];
  7. _itoa_s(nVal, buff, 10);
  8. strRet = buff;
  9. return strRet;
  10. }
  11. CString LongToStr(long lVal)
  12. {
  13. CString strRet;
  14. char buff[20];
  15. _ltoa_s(lVal, buff, 10);
  16. strRet = buff;
  17. return strRet;
  18. }
  19. CString ULongToStr(unsigned long ulVal)
  20. {
  21. CString strRet;
  22. char buff[20];
  23. _ultoa_s(ulVal, buff, 10);
  24. strRet = buff;
  25. return strRet;
  26. }
  27. CString DblToStr(double dblVal, int ndigits)
  28. {
  29. CString strRet;
  30. char buff[50];
  31. //_gcvt(dblVal, ndigits, buff);
  32. _gcvt_s(buff, 50, dblVal, ndigits);
  33. strRet = buff;
  34. return strRet;
  35. }
  36. CString DblToStr(float fltVal)
  37. {
  38. CString strRet = _T("");
  39. char buff[50];
  40. //_gcvt(fltVal, 10, buff);
  41. _gcvt_s(buff, 50, fltVal, 10);
  42. strRet = buff;
  43. return strRet;
  44. }