• _itoa _itow _itot atoi atof atol


    函数原型:

    char *_itoa( int value, char *string, int radix );  //ANSI
    wchar_t * _itow( int value, wchar_t *string, int radix );//UNICODE

    _itot 只是一个宏,根据系统定义的字符集来去_itoa或者_itow, 对应的安全函数为_itot_s
    说明:把int 转化为字符串,value为被转化的值,string为转化的目的字符串, radix为基数必须在2到36之间.
    所需头文件 #include <stdlib.h>
    举例说明:这里用它们的安全函数: _itoa_s _itow_s
    char szYearA[5] = {0};
    WCHAR szYearW[5] = {0};
    _itoa_s(100, szYearA, 10);
    _itow_s(100, szYearW, 10);


    atoi atof atol

    Convert strings to double (atof), integer (atoi, _atoi64), or long (atol).

    double atof( const char *string );
    int atoi( const char *string );
    _int64 _atoi64( const char *string );
    long atol( const char *string );
    举例:
    double d1 = atof("sa34"); //d1 = 0.00000000000000000
    double d2 = atof("34gdf"); //d2 = 34.000000000000000
    double d3 = atof("-0343"); //d3 = -343.00000000000000
    double d4 = atof("008"); //d4 = 8.0000000000000000
    int i1 = atoi("df"); //i1 = 0
    int i2 = atoi("54.34"); //i2 = 54
    int i3 = atoi("-54"); //i3 = -54
    int i4 = atoi("09"); //i4 = 9
  • 相关阅读:
    Python基础07
    python基础06
    python基础05
    python基础04
    python基础03
    python基础02
    python组件之wtforms
    PythonWeb框架之Flask
    Linux下yum安装Redis
    在vuex的mutations中使用vue的小技巧
  • 原文地址:https://www.cnblogs.com/priarieNew/p/9754127.html
Copyright © 2020-2023  润新知