日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

VC中数字与字符串转换方法

發(fā)布時間:2023/12/15 c/c++ 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 VC中数字与字符串转换方法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

VC中數(shù)字與字符串轉(zhuǎn)換方法

u???? 字符串轉(zhuǎn)數(shù)字

?

l???????? 1CRT函數(shù)

?

?

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

?

l???????? 2.使用sscanf

?

l???????? 3.Windows SDK<shlwapi.h>StrToInt

?

l???????? 4.MFC/ATLCString::Format

?

u???? 數(shù)字轉(zhuǎn)字符串

l???????? 1CRT函數(shù)

?

?

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

?

l???????? 2.使用sprintf

?

l???????? 3.<strsafe.h>StringCbPrintf

?

u???? 通用相互轉(zhuǎn)換方法

l???????? C++流方式:stringstream?

?

l???????? 2.boost庫:boost:: lexical_cast

摘自MSDNData-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, _itow, _itoa_s, _itow_s, _i64tow_s

Convert int to string

_i64toa, _ui64toa, _i64tow, _ui64tow, _i64toa_s, _ui64toa_s, _ui64tow_s

Convert __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

?

原帖:http://www.cppblog.com/tbyxyz/articles/str2num.html

總結(jié)

以上是生活随笔為你收集整理的VC中数字与字符串转换方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。