数据转换
来源:互联网 发布:淘宝新店三个月刷到3钻 编辑:程序博客网 时间:2024/04/29 20:25
字符串转数字
1.CRT函数
ASCII
UNICODE
TCHAR
VS2005
int
atoi
_wtoi
_tstoi
_ttoi
_atoi_l
_wtoi_l
long
atol
_wtol
_tstoi
_ttoi
_atoi_l
_wtoi_l
__int64
_atoi64
_wtoi64
_tstoi64
_ttoi64
_atoi64_l
_wtoi64_l
float
_atoflt
_atoflt_l
double
atof
_wtof
_tstof
_ttof
_atof_l
_wtof_l
_atodbl
_atodbl_l
long double
_atoldbl
_atoldbl_l
2.使用sscanf
3.Windows SDK:
<shlwapi.h>:StrToInt
4.MFC/ATL:
数字转字符串
1.CRT函数
ASCII
UNICODE
TCHAR
VS2005
int
itoa
_itoa
_itow
_itot
long
ltoa
_ltoa
_ltow
_ltot
__int64
_i64toa
_i64tow
_i64tot
double
gcvt
_gcvt
_ecvt
_fcvt
_wtof
_tstof
_ttof
_gcvt_s
_ecvt_s
_fcvt_s
2.使用sprintf
3.<strsafe.h>:StringCbPrintf
通用相互转换方法
1.C++流方式:
stringstream
2.boost库:
boost:: lexical_cast
摘自MSDN:
Data-Conversion Routines
Routine
Use
atof, _atof_l, _wtof, _wtof_l
Convert string to float
atoi, _atoi_l, _wtoi, _wtoi_l
Convert string to int
_atoi64, _atoi64_l, _wtoi64, _wtoi64_l
Convert string to __int64
atol, _atol_l, _wtol, _wtol_l
Convert string to long
_ecvt, _ecvt_s
Convert double to string of specified length
_fcvt, _fcvt_s
Convert double to string with specified number of digits following decimal point
_gcvt, _gcvt_s
Convert double number to string; store string in buffer
_itoa, _i64toa, _ui64toa, _itow, _i64tow, _ui64tow, _itoa_s, _i64toa_s, _ui64toa_s, _itow_s, _i64tow_s, _ui64tow_s
Convert int or __int64 to string
_ltoa, _ltow, _ltoa_s, _ltow_s
Convert long to string
strtod, _strtod_l, wcstod, _wcstod_l
Convert string to double
strtol, wcstol, _strtol_l, _wcstol_l
Convert string to long integer
strtoul, _strtoul_l, wcstoul, _wcstoul_l
Convert string to unsigned long integer
_ultoa, _ultow, _ultoa_s, _ultow_s
Convert unsigned long to string
atof, _atof_l, _wtof, _wtof_l
Convert wide-character string to a double
atoi, _atoi_l, _wtoi, _wtoi_l
Convert wide-character string to int
_atoi64, _atoi64_l, _wtoi64, _wtoi64_l
Convert wide-character string to __int64
atol, _atol_l, _wtol, _wtol_l
Convert wide-character string to long
例如:
TCHAR a[10];
_ttoi(a);
_itoa(100, a, 10);
_itoa_s(100, a, strlen(a), 10);
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 数据转换
- 转换数据
- 数据转换
- 数据转换
- Minimal coverage - UVa 10020 贪心
- 面试题2
- 04-2. 打印九九口诀表
- 第18周项目1-动态链表体验(3.删除结点)
- 在Unity中使用事件/委托机制(event/delegate)进行GameObject之间的通信
- 数据转换
- 关于(a+b)/3的证明--codeforces,519c.
- CSS背景图片定位(background-position,css sprit,背景定位,background-imag
- DirectX编程:利用 DirectSound 录音
- 【Unity3D插件】在Unity中读写文件数据:LitJSON快速教程
- c++ 工厂设计模式
- 2015届华为软件研发面试经验(提前批)
- uva3644 X-Plosives
- Android Action Bar 详解篇