Solved

Deleting the temporary files, VC++ 6.0

Posted on 2008-10-21
1
464 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
1 Comment
 

Accepted Solution

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


0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now