先上代码 [code] AreaCode1 = atol(pMsg->strAreaCode); Areacode2 = atol(m_sMsg.strAreaCode); printf("OpMsg [%s:%d][%s:%d]",pMsg->strAreaCode,lAreaCode1,m_sMsg.strAreaCode,lAreacode2);[/code] 程序运行正常一段时间之后,打印出来的突然就如下 OpMsg [0415:415][24:24] OpMsg [0415:415][411:411] OpMsg [0415:415][412:412] OpMsg [0415:415][413:413] OpMsg [0415:415][414:414] OpMsg [0415:415][415:415] OpMsg [...
by foolishfox - C/C++ - 2010-01-13 12:22:03 阅读(2986) 回复(13)
常用到atoi/atol/atof转换函数, 很容易理解当string是ASCII中单个字符时的转换, 但当string是一个字符串时如 [CODE] const char* p = "1000.29" long result = atol(p); //结果应该是:1000.29, 难道不是吗? [/CODE] 字符串"1000.29"在内存中占有7个字节: [CODE] [ASCII中1的编码] [ASCII中0的编码] [ASCII中0的编码] [ASCII中0的编码] [ASCII中0的编码] [ASCII中.的编码] [ASCII中2的编码] [ASCII中9的编码] [/CODE] 那么这些字节...
GCC 4.3 related build problems: missing #include In GCC 4.3 the C++ header dependencies have been cleaned up . In the past, compilation would often be quite slow because including a simple header would indirectly include a lot of other headers, even if they were not needed to compile the current code. Many headers have now been cleaned up with the result that compilation is quicker. The dow...
atoi,atol,strtod,strtol,strtoul实现类型转换 atof(将字符串转换成浮点型数) 相关函数 atoi,atol,strtod,strtol,strtoul 表头文件 #include 定义函数 double atof(const char *nptr); 函数说明 atof()会扫描参数nptr字符串,跳过前面的空格字符,直到遇上数字或正负符号才开始做转换,而再遇到非数字或字符串结束时('')才结束转换,并将结果返回。参数nptr字符串可包含正负号、小数点或E(e)来表...