如何将数值型变量转换成字符串型

如题所述

一
将字符串转为浮点数:double atof(const char* pString);
反之:
1对1接口:char *ecvt(double dValue,int iNdig,int *pDec,int * pSign);
单浮点接口:char *fcvt(double dValue,int iNdig,int *pDec,int * pSign);
积数接口:char *gcvt(double dValue,int iNdec,char* pBuf);

二
串转为整型:int atoi(const char *pString);
反之:
char *itoa(int iValue,char * pString,int iRadix);
三
串转为长整型:long atol(const char *pString);
long strtod(const char *pString,char **ppEndptr,int iRadix);
如转为给定基数的无符号长整:
unsigned long strtul(const cahr *pString,char **ppEndptr,int iRadix);
反之:
char *ltoa(long lValue,char * pString,int iRadix);
四
串转为双精度:
double strtod(const char * pString,char **ppEndptr);

如果你在这里还找不到你喜欢的话,就用c-asm吧,
这是我可以想起来的所有函数 了。

多多交流
温馨提示:答案为网友推荐,仅供参考
相似回答