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);
}