VC文本文件读写

来源:互联网 发布:平均智商 知乎 编辑:程序博客网 时间:2024/06/05 23:25

CFile类:

CFile file;
   if(file.Open("filename.txt",CFile::modeReadWrite|CFile::modeCreate))
   {
           CString str;
           str.Format("%d/n",i);
           file.Write(str,str.GetLength());
    }

 

FILE类:

FILE *file = fopen("filename.txt","w+");


      fprintf("%d/n",i);