您的位置:首页 > 其它

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

2012-06-29 17:31 381 查看

字符串转数字

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:

CString::Format

数字转字符串

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: