永发信息网

c++中itoa是什么意思

答案:1  悬赏:80  手机版
解决时间 2021-04-05 09:38
c++中itoa是什么意思
最佳答案
是int 转string类型的一个函数
msdn上是这么写的
_itoa, _i64toa, _ui64toa, _itow, _i64tow, _ui64tow
Convert an integer to a string.

char *_itoa( int value, char *string, int radix );

char *_i64toa( __int64 value, char *string, int radix );

char * _ui64toa( unsigned _int64 value, char *string, int radix );

wchar_t * _itow( int value, wchar_t *string, int radix );

wchar_t * _i64tow( __int64 value, wchar_t *string, int radix );

wchar_t * _ui64tow( unsigned __int64 value, wchar_t *string, int radix );

Routine Required Header Compatibility
_itoa Win 95, Win NT
_i64toa Win 95, Win NT
_ui64toa Win 95, Win NT
_itow Win 95, Win NT
_i64tow Win 95, Win NT
_ui64tow Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

Each of these functions returns a pointer to string. There is no error return.

Parameters

value

Number to be converted

string

String result

radix

Base of value; must be in the range 2 – 36

Remarks

The _itoa, _i64toa, and _ui64toa function convert the digits of the given value argument to a null-terminated character string and stores the result (up to 33 bytes) in string. If radix equals 10 and value is negative, the first character of the stored string is the minus sign ( – ). _itow, _i64tow, and _ui64tow are wide-character versions of _itoa, _i64toa, and _ui64toa respectively.

Generic-Text Routine Mappings

TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_itot _itoa _itoa _itow

Example



#include
#include

void main( void )
{
char buffer[20];
int i = 3445;
long l = -344115L;
unsigned long ul = 1234567890UL;

_itoa( i, buffer, 10 );
printf( "String of integer %d (radix 10): %s\n", i, buffer );
_itoa( i, buffer, 16 );
printf( "String of integer %d (radix 16): 0x%s\n", i, buffer );
_itoa( i, buffer, 2 );
printf( "String of integer %d (radix 2): %s\n", i, buffer );

_ltoa( l, buffer, 16 );
printf( "String of long int %ld (radix 16): 0x%s\n", l,
buffer );

_ultoa( ul, buffer, 16 );
printf( "String of unsigned long %lu (radix 16): 0x%s\n", ul,
buffer );
}

Output

String of integer 3445 (radix 10): 3445
String of integer 3445 (radix 16): 0xd75
String of integer 3445 (radix 2): 110101110101
String of long int -344115 (radix 16): 0xfffabfcd
String of unsigned long 1234567890 (radix 16): 0x499602d2

Data Conversion Routines

See Also _ltoa, _ultoa
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
9.8.7.6.5.4.3.2.1怎么加减等于100
观察钟表.时针从3时到4时,旋转了多少度?分
1.3.5.7.9.11.13.15.怎么用三个字加起来等于3
高中必背化学方程式书籍
百森·橱柜·衣柜工厂店地址有知道的么?有点
金色童年儿童摄影美术馆在哪里啊,我有事要去
牙科护士配台自我指正
昨天遇到什么事情了,请大家分析。有人从上海
解答题为进一步落实群众对干部选拔、任用工作
清明后我放了几只蛇笼捕蛇,可是为什么到现在
命中良心
我想知道蓝梦美容美发学校现在报名有什么优惠
倡导法治宣传标语,关于法治的标语或口号
什么是亚粘土、亚砂土?各自的成分百分数,怎
阅读理解GotoThailand(泰国)—it’sagreatpla
推荐资讯
Apple watch 两千多的和四五千的有啥区别呀…
劝人积德行善的诗句,一日行善或劝人行善的句
Although the teacher didn’t mention any n
孩子本科毕业祝福话语,对孩子祝福的话语,比如
Theycameto________goodbyetothetea
羊羔毛怎么清洗,羊羔毛衣服怎么清洗?
为什么小新700电竞版玩h1z1很卡
祝贺公司开业诗词,公司开业诗词
舒城安天盛世名城7期什么时间开盘
安阳到秦皇岛多少公里,秦皇岛至浙江走高速油
小语微商管家哪里有正版买
放下过去的语句,形容放下的句子
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?