int save1d(const char* fn, float* data, int nx)
{
fstream of(fn, ios::out | ios::binary);
if (!of)
{
cout << "Cannot open file " << fn << endl;
exit(EXIT_FAILURE);
return -1;
}
of.write(reinterpret_cast<char*>(data), sizeof(float) * nx);
cout <<"Data is saved in "<< fn <<" with size "<<nx << endl;
of.flush();
of.close();
return 0;
}
【 在 haiguimm 的大作中提到: 】
: 发呆码
--
FROM 116.236.22.*