转自:https://blog.csdn.net/boyixuanbo/article/details/79778266
#include <iostream>
#include <string.h>
#include <sstream>
using namespace std;
int main()
{
double freq1=12.4500;
ostringstream oss1;
oss1<<freq1;
char fileName[50];
memset(fileName,0,50);
//先转化为流,再转换为string,然后再转换为char
strcat(fileName,(oss1.str()).c_str());
for(int i=0;i<strlen(fileName);++i)
{
cout<<fileName[i];
}
cout<<endl;
return 0;
}