atoi,atol,strtod,strtol,strtoul実装タイプ変換

6402 ワード

atof(           ) 

atoi,atol,strtod,strtol,strtoul

#include <stdlib.h>

double atof(const char *nptr);

atof() nptr , , , (’’) , 。 nptr 、 E(e) , 123.456 123e-2。



atof() strtod(nptr,(char**)NULL) 。
atoi(          ) 

atof,atol,atrtod,strtol,strtoul

#include<stdlib.h>

int atoi(const char *nptr);

atoi() nptr , , , (’’) , 。



atoi() strtol(nptr,(char**)NULL,10); 。

atol( )

atof,atoi,strtod,strtol,strtoul

#include<stdlib.h>

long atol(const char *nptr);

atol() nptr , , , (’’) , 。



atol() strtol(nptr,(char**)NULL,10); 。

gcvt( , )

ecvt,fcvt,sprintf

#include<stdlib.h>

char *gcvt(double number,size_t ndigits,char *buf);

gcvt() number ASCII , ndigits 。gcvt() ecvt() fcvt() ,gcvt() 。 , buf 。

, buf 。

strtod( )

atoi,atol,strtod,strtol,strtoul

#include<stdlib.h>

double strtod(const char *nptr,char **endptr);

strtod() nptr , , , (’’) , 。 endptr NULL, nptr endptr 。 nptr 、 E(e) 。 123.456 123e-2。



atof()。

strtol( )

atof,atoi,atol,strtod,strtoul

#include<stdlib.h>

long int strtol(const char *nptr,char **endptr,int base);

strtol() nptr base 。 base 2 36, 0。 base , base 10 10 , base 16 16 。 base 0 10 , ’0x’ 16 。 strtol() nptr , , , (’’) , 。 endptr NULL, nptr endptr 。

, ERANGE errno 。

ERANGE 。

strtoul( )

atof,atoi,atol,strtod,strtol

#include<stdlib.h>

unsigned long int strtoul(const char *nptr,char **endptr,int base);

strtoul() nptr base 。 base 2 36, 0。 base , base 10 10 , base 16 16 。 base 0 10 , ’0x’ 16 。 strtoul() nptr , , , (’’) , 。 endptr NULL, nptr endptr 。

, ERANGE errno 。

ERANGE 。

toascii( ASCII )

isascii,toupper,tolower

#include<ctype.h>

int toascii(int c)

toascii() c 7 unsigned char , , ASCII 。

ASCII 。

tolower( )

isalpha,toupper

#include<stdlib.h>

int tolower(int c);

c 。

, c 。


toupper( )

isalpha,tolower

#include<ctype.h>

int toupper(int c);

c 。

, c 。
http://blog.csdn.net/mycaibo