Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Deleting the temporary files, VC++ 6.0

Posted on 2008-10-21
1
Medium Priority
?
481 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
ID: 22904660
I flushed out the memory of all COM components and then tried to delete and that worked.


0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

916 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