Link to home
Start Free TrialLog in
Avatar of daniel_c
daniel_c

asked on

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
Avatar of dhertzfe
dhertzfe

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.
ASKER CERTIFIED SOLUTION
Avatar of PeterLarsen
PeterLarsen

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
Avatar of daniel_c

ASKER

Thanks Peter!!!