乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > 怎样用<em>MFC</em>读取全部txt文本内容并显示到EDIT控件里面-mfc 打开exc

怎样用<em>MFC</em>读取全部txt文本内容并显示到EDIT控件里面-mfc 打开exc

作者:乔山办公网日期:

返回目录:excel表格制作


CString str =" ";
CStdioFile file;
file.Open("test.txt",CFile::modeRead);//打开文
//逐行读取字符串
while( file.ReadString(str ))
{
//设置到编辑框
MessageBox(str); //test
}
file.Close();//关闭文件

有什么问题的话可以追问~

do
{
myFile.ReadString(str1);
str2=str2+str1;
}
while(myFile.ReadString(str1));
Read了两次,但有一次没有处理。
可以这样:

do
{
myFile.ReadString(str1);
str2=str2+str1;
}
while(str1.Length()>0);
#include "locale"
......
CStdioFile f;
CString str;
if(f.Open(m_filename,CFile::modeRead | CFile::typeText))
{
CString s;
setlocale(LC_CTYPE, "chs");
while (f.ReadString(s))
{
str += s;
}
f.Close();
}
SetDlgItemText(IDC_BUTTON1,str);


excel文件,需要你了解他的文件结构,然后自己写二进制读取,

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网