我是靠谱客的博主 激动铅笔,这篇文章主要介绍VC:CFile(向文件读写数据、Edit控件),现在分享给大家,希望可以做个参考。

 

       CString str="";

       GetDlgItemText(IDC_EDIT1,str);

       CFile file;

       if(!file.Open("test.txt",CFile::modeReadWrite))

              file.Open("test.txt",CFile::modeReadWrite|CFile::modeCreate);

       else

       {

              file.SeekToEnd();

              file.Write(str,str.GetLength());

              SetDlgItemText(IDC_EDIT1,"");

 

              file.SeekToBegin();

              str="";

              char *c;

              c=new char[file.GetLength()+1];

              c[file.GetLength()+1]=0;

              file.Read(c,file.GetLength());

              str=c;

              SetDlgItemText(IDC_EDIT2,str);

       }

转载于:https://www.cnblogs.com/shenchao/archive/2012/10/15/2725061.html

最后

以上就是激动铅笔最近收集整理的关于VC:CFile(向文件读写数据、Edit控件)的全部内容,更多相关VC内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(120)

评论列表共有 0 条评论

立即
投稿
返回
顶部