File Lock???

I have a text file (the size about 3 Mb).
I read that file and store it to table (TTable).
After all process done, and I close the file using command: system.close(FileVar).
After that I move file to specified folder using API function MoveFile.
The problem is sometimes, it returns error, called ERROR_ACCESS_DENIED
(get from GetLastError function).
It seems that the system still locks the file.
How to solve this problem?

Need help from any Delphi Expert

Daniel
LVL 7
daniel_cAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
PeterLarsenConnect With a Mentor Commented:
Hi daniel c,

I have had a similar problem some time ago :

http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=10109545 

Good luck
Peter
0
 
dhertzfeCommented:
Are you using Windows NT?

I had this same problem with NT.  I solved the problem by adding a Sleep(200) after closing the file.
0
 
daniel_cAuthor Commented:
Thanks Peter!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.