Solved

_close() for file handle issue in windows

Posted on 2004-10-04
3
271 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

A short article about problems I had with the new location API and permissions in Marshmallow
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

749 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