我的代码如下:
CFile m_file;
double *m_new;
m_file.write(m_new,2100*sizeof(double));
可是文本文档的东西是乱码,并不是本来的数据,我不知道
哪里有问题,请帮忙!!!

解决方案 »

  1.   

    我觉得你write函数的第2个参数理解不正确。你的2100是什么意思。第2个参数的含义:The number of bytes to be transferred from the buffer. 
    (缓冲区的大小。)建议你用字符串型处理。
    CFile m_file;
    double *m_new;
    CString tmp;
    tmp.Format("%f",*m_new);
    m_file.write(m_new,tmp.GetLength());
      

  2.   

    先把数据通过CString对象的类型转换成string,应该可以吧。
    CString str;
    str.Format("....",m_new);
    然后write这个str
      

  3.   

    我不知道该怎么给分,帮个忙,tell me!