Link to home
Start Free TrialLog in
Avatar of rbhargaw
rbhargawFlag for United States of America

asked on

Deleting the temporary files, VC++ 6.0

Hi,

We have an correspondence application developed in VC++ and using mail merge technology which sends emails to the customers in word documents. Here is my code which is used to delete the temp files once the email is sent , but the "retD returns 0", which means it failed to delete the file and the file is still haging in the temp folder.

I used the GetLastError() function and it returns 2, which means "File Not found Error"
but I put check "fileN" , it does shows the exact path and the document name which need to be deleted.

Can you one point me in right direction as to how to delete the file?

Thanks
Roop




// delete temporary files
BOOL retD;
			
for ( i = 0; i < mergedFiles.GetSize(); i++ ) 
{
	CString fileN = mergedFiles[i];
	//retD = DeleteFile (mergedFiles[i]);
	retD = DeleteFile(fileN);
}
 
mergedFiles is an CStringArray

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of rbhargaw
rbhargaw
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial