VC中数字与字符串转换方法 字符串转数字 1.CRT函数
int ASCII atoi UNICODE _wtoi TCHAR _tstoi _ttoi VS2005 _atoi_l _wtoi_l _atoi_l _wtoi_l _atoi_l _wtoi_l _atoflt _atoflt_l long atol _wtol _tstoi _ttoi __int _atoi _wtoi _tstoi _ttoi float double atof _wtof _tstof _ttof _atof_l _wtof_l _atodbl _atodbl_l long double 2.使用sscanf _atoldbl _atoldbl_l 3.Windows SDK: CString::Format(此函数应该是用来将数字转成字符, MSDN中有解释) 数字转字符串 1.CRT函数 int long __int double ASCII itoa _itoa ltoa _ltoa _itoa _itow gcvt _gcvt _ecvt _fcvt 2.使用sprintf 3. _wtof _itot _tstof _ttof _gcvt_s _ecvt_s _fcvt_s _ltow _ltot UNICODE _itow TCHAR _itot VS2005 通用相互转换方法 1.C++流方式: stringstream 2.boost库: boost:: lexical_cast 摘自MSDN: Data-Conversion Routines Routine atof, _atof_l, _wtof, _wtof_l atoi, _atoi_l, _wtoi, _wtoi_l Use Convert string to float Convert string to int _atoi, _atoi_l, _wtoi, _wtoi_l Convert string to __int atol, _atol_l, _wtol, _wtol_l _ecvt, _ecvt_s Convert string to long Convert double to string of specified length Convert double to string with specified number of digits following decimal point Convert double number to string; store string in buffer _fcvt, _fcvt_s _gcvt, _gcvt_s _itoa, _itoa, _uitoa, _itow, Convert int or __int to _itow, _uitow,_itoa_s, _itoa_s, string _uitoa_s, _itow_s, _itow_s, _uitow_s _ltoa, _ltow, _ltoa_s, _ltow_s strtod, _strtod_l, wcstod, _wcstod_l strtol, wcstol, _strtol_l, _wcstol_l Convert long to string Convert string to double Convert string to long integer strtoul, _strtoul_l, wcstoul, _wcstoul_l Convert string to unsigned longinteger _ultoa, _ultow, _ultoa_s, _ultow_s Convert unsigned long to string Convert wide-character string to adouble Convert wide-character string to int atof, _atof_l, _wtof, _wtof_l atoi, _atoi_l, _wtoi, _wtoi_l _atoi, _atoi_l, _wtoi, _wtoi_l Convert wide-character string to__int atol, _atol_l, _wtol, _wtol_l Convert wide-character string 因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- jqkq.cn 版权所有 赣ICP备2024042794号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务