|
-
July 21st, 2009, 12:07 AM
#1
Save button MFC
hi guys nid some help here
For the save button i was suppose to save my input into a text file.And i was suggested by my friends to use append so that when i typed in a new input the old input wouldnt get deleted,so hw shall i go about doing this.
Before that i was using CFile but my friend said that CFile doesnt have an append function so my old input would get deleted.
THis is my old code for reference.
void CFileProcDlg::OnBnClickedSaveBtn()
{
// TODO: Add your control notification handler code here
this->UpdateData();
CFile f;
char strFilter[] = { "TXT Files (*.txt)|*.txt|All Files (*.*)|*.*||" };
CFileDialog FileDlg(FALSE, ".txt", NULL, 0, strFilter);
if( FileDlg.DoModal() == IDOK )
{
f.Open(FileDlg.GetFileName(), CFile::modeCreate | CFile::modeWrite);
CArchive ar(&f, CArchive::store);
ar << m_Date << m_Time << m_File ;
ar.Close();
}
else
return;
f.Close();
ps. im using MFC vs 2005
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|