码迷,mamicode.com
首页 > 其他好文 > 详细

读写txt文件

时间:2018-12-03 16:30:41      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:cfile   读取   std   关闭   message   bsp   文件打开   sage   cstring   

读取txt文件中的内容放如cstring变量中:

 CString filePath;

 CStdioFile file;

//打开文件

  if(!file.Open(filePath,CFile::modeRead))

{

   ::AfxMessageBox(_T("文件打开失败!"));

   return;

}

//读取文件内容

CString strText = _T(" ");

file.ReadString(strText));

//关闭文件

file.Close();

 

读写txt文件

标签:cfile   读取   std   关闭   message   bsp   文件打开   sage   cstring   

原文地址:https://www.cnblogs.com/Grouth-Diary/p/10059033.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!