c++ float类型转换成字符串的几种方法
摘要:对于float f; 方法1: char buf[32]; snprintf(buf, sizeof(buf), "%f ", f); string s = buf; 方法2: #include <stdlib.h> char buf[32]; _gcvt(f, 16, buf); string s = buf; 方法3: #include <sstream> ostringstream oss; oss < < f; string s = oss.str(); 方法4: //使用boost库: string ...
阅读全文
posted @
2012-10-07 22:11
thisiswoa
阅读(2331)
推荐(0)