c++中如何将一个复数数组写入dat文件

c++中如何将一个复数数组写入dat文件,复数数组形式为complex(0,0)急求 ,求大神解答!!!

CFile m_fileSave;
m_fileSave.Open(m_strSaveName, CFile::modeCreate | CFile::modeReadWrite);
m_fileSave.Write(变量,字节数 );
m_fileSave.Close();

 ofstream fout("x:\\data.txt");
for (int i = 0; i < n; i++)
    fout << arr[i];
fout.close();

#include "math.h"
#include
#include
#include
using namespace std;

void DFT(complex a[],complex b[],int N)
{
for (int k=0;k {
b[k]=complex(0,0);

for(int n=0;n {
complexY = complex(0,(2*3.141592654*k*n/N));

 b[k]=b[k]+(a[n]*(exp(Y)));
 }

}
}

int main()
{
complex x[4]={complex(1,0),complex(1,0),complex(1,0),complex(1,0)};
complex y[4];
complexz[4];

DFT(x,y,4);

for(int k=0;k<4;k++)
{

cout<<"y["<<k<<"]="<<y[k];

}

}