_close() for file handle issue in windows
Posted on 2004-10-04
Im opening a binary file and reading block by block of data from it using _open() and _read() and closing the file with _close(). For reading each record im opening and closing the file.Iam reading the file in binary read mode.
After i process all the records i need to move the file to a different folder. Which im unable to do. The error is sharing voilation. I made sure that all the file handles are closed. Even then im not able to move the file instead im able to copy the file. But my requirement is i need to move this file.
This problem is not occuring for each and every file. this is only occuring at times. Is this anything to do with Os not releasing the file handle.
I also tried it by putting a sleep of 1second between the binary file reading and moving the file. Did any body face this issue and can anyone tell me a solution.
Thanks in advance