Solved

Deleting the temporary files, VC++ 6.0

Posted on 2008-10-21
1
475 Views
Last Modified: 2012-05-05
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

0
Comment
Question by:rbhargaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
rbhargaw earned 0 total points
ID: 22904660
I flushed out the memory of all COM components and then tried to delete and that worked.


0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question