如何将c++编辑好的代码输出的结果显示在MFC中的编辑框中呢?在MFC中我双击那个编辑框后出现如下代码:
void CAsyncToolDlg::OnChangeEdit4()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}而我现在编写好的C++代码是:
#include <fstream.h>const char *file="file.txt";int main()
{
ifstream input_file;
int loop;
char ch='A';
input_file.open(file,ios::binary);
if(!input_file){
cout<<"Can not open the file!"<<endl;
return 1;
}
for(loop=0;loop<500&&input_file.get(ch);loop++)
{
input_file.tellg();
cout<<"文件名:";
cout<<ch;
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"大小:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"修改时间:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"属性:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
input_file.ignore(1,'*');
cout<<endl;
}
input_file.close();
return 0;
}我现在要怎么改这个代码才能实现在MFC文本框中输出运行结果呢?小弟没学过MFC希望牛人指点。谢谢。。
void CAsyncToolDlg::OnChangeEdit4()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}而我现在编写好的C++代码是:
#include <fstream.h>const char *file="file.txt";int main()
{
ifstream input_file;
int loop;
char ch='A';
input_file.open(file,ios::binary);
if(!input_file){
cout<<"Can not open the file!"<<endl;
return 1;
}
for(loop=0;loop<500&&input_file.get(ch);loop++)
{
input_file.tellg();
cout<<"文件名:";
cout<<ch;
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"大小:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"修改时间:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
cout<<"属性:";
while(input_file.get(ch)&&ch!='*') cout<<ch;
input_file.ignore(1,'*');
cout<<endl;
}
input_file.close();
return 0;
}我现在要怎么改这个代码才能实现在MFC文本框中输出运行结果呢?小弟没学过MFC希望牛人指点。谢谢。。
然后updatedata(true);
这是其中一个方法,不过会刷新界面所有的东西。。