资源描述:
《vc中数字与字符串转换方法》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、VC中数字与字符串转换方法字符串转数字1.CRT函数 ASCIIUNICODETCHARVS2005intatoi_wtoi_tstoi_ttoi_atoi_l_wtoi_llongatol_wtol_tstoi_ttoi_atoi_l_wtoi_l__int64_atoi64_wtoi64_tstoi64_ttoi64_atoi64_l_wtoi64_lfloat _atoflt_atoflt_ldoubleatof_wtof_tstof_ttof_atof_l_wtof_l_atodbl_atodbl_llongdouble _at
2、oldbl_atoldbl_l2.使用sscanf3.WindowsSDK::StrToInt4.MFC/ATL: CString::Format (此函数应该是用来将数字转成字符,MSDN中有解释)数字转字符串1.CRT函数 ASCIIUNICODETCHARVS2005intitoa_itoa_itow_itot longltoa_ltoa_ltow_ltot __int64_i64toa_i64tow_i64tot doublegcvt_gcvt_ecvt_fcvt_wtof_tstof_ttof_gcvt_
3、s_ecvt_s_fcvt_s2.使用sprintf3.:StringCbPrintf 通用相互转换方法1.C++流方式:stringstream 2.boost库:boost:: lexical_cast摘自MSDN:Data-ConversionRoutinesRoutineUseatof,_atof_l,_wtof,_wtof_lConvertstringto floatatoi,_atoi_l,_wtoi,_wtoi_lConvertstringto int_atoi64,_atoi64_l,_wtoi64,_wt
4、oi64_lConvertstringto __int64atol,_atol_l,_wtol,_wtol_lConvertstringto long_ecvt, _ecvt_sConvert double tostringofspecifiedlength_fcvt, _fcvt_sConvert double tostringwithspecifiednumberofdigitsfollowingdecimalpoint_gcvt, _gcvt_sConvert double numbertostring;storestringinbuffe
5、r_itoa,_i64toa,_ui64toa,_itow,_i64tow,_ui64tow,_itoa_s,_i64toa_s,_ui64toa_s,_itow_s,_i64tow_s,_ui64tow_sConvert int or __int64 tostring_ltoa,_ltow, _ltoa_s,_ltow_sConvert long tostringstrtod,_strtod_l,wcstod,_wcstod_lConvertstringto doublestrtol,wcstol,_strtol_l,_wcstol_lConv
6、ertstringto long integerstrtoul,_strtoul_l,wcstoul,_wcstoul_lConvertstringto unsignedlonginteger_ultoa,_ultow, _ultoa_s,_ultow_sConvert unsigned long tostringatof,_atof_l,_wtof,_wtof_lConvertwide-characterstringtoadoubleatoi,_atoi_l,_wtoi,_wtoi_lConvertwide-characterstringto
7、int_atoi64,_atoi64_l,_wtoi64,_wtoi64_lConvertwide-characterstringto__int64atol,_atol_l,_wtol,_wtol_lConvertwide-characterstring