Hi,
at the moment i code my little project in MFC (ok i try it, becuase it is my first time with the MFC).
I wrote a method which search for a file and then the file should be deleted. I used similar the same method as in my DOS version..with remove().
But the program does not delete the file. I tried DeleteFile and also _unlink..nothing works :-/
Here my code (i removed the MessageBox things to reduce the code here)
Code:
void CDialog3::OnSearch()
{
UpdateData(true); //for a edit field
char temp_char[20];
strcpy(temp_char, m_input2); //m_input was for the edit field
findPath("C:", temp_char, buffer); //call the seach function
MessageBox(temp_char, "test"); //just for the tests
//(if the temp_char has really the file name)
if (remove(temp_char) == 0)
{
MessageBox("removed", "sucessfully deleted");
}
else
{
MessageBox("sorry was not able to remove file", "error");
}
}
}