Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

_close() for file handle issue in windows

Posted on 2004-10-04
3
Medium Priority
?
288 Views
Last Modified: 2012-05-05
Hi all,

  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

Vidya
0
Comment
Question by:vidyavardhan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:vidyavardhan
ID: 12274003
I have found the solution for myself the file i was trying to copy was being opened and accessed for 50 times before i copy it. So OS in this sittuation is taking 500 milliseconds to release the file handle.

Thus the problem is fixed.

Thank you
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12502626
PAQed, with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

670 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