if(!f.Open(filename,CFile::modeCreate | CFile::modeReadWrite)) f.Open(filename,CFile::modeCreate); The first click it will create file. I want at the second click, third,4,5,.... click in button2, it will append my file, not delete and create new file like above !! Can you help me ... !!!!!!!!!!!!
vhazell
Posts
-
I have an error -
I have an errorThank so much !! But how can i slove it .... Can you show me ..... I've just program...
-
I have an errorHi all !! I practise VC. When I code my program to create a file. The first time when I click my button2 (create file) I receive a error "access pathdir to file is denied" but I can create file at the second click. I don't know why ??? Please,I need help !! This's my code when click button2, I use MFC wizard (use dialogbase) void CTestDlg::OnButton2() { // TODO: Add your control notification handler code here char filename[100]; GetCurrentDirectory(100,filename); strcat(filename,"\\RongVang.dat"); CFile f; if(!f.Open(filename,CFile::modeReadWrite)) f.Open(filename,CFile::modeCreate); f.SeekToEnd(); char s[100]; strcpy(s,"Test Create file"); f.Write(s,100); } -- modified at 22:36 Sunday 16th October, 2005