Computing.Net > Forums > Programming > Dangling file handles with MS w2k..

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Dangling file handles with MS w2k..

Reply to Message Icon

Name: Carlls
Date: July 23, 2007 at 10:06:19 Pacific
OS: W2K,XP
CPU/Ram: 2GB
Product: Dell
Comment:

The application is written in C, linking in the commode.obj modules

I believe this is do to the “delayed cache write” behavior of windows, but need a work around.


The scenario is as follows:

Works:
Program 1 starts
Program 1 opens file A
Program 1 close file A
Program 1 exits
Program 2 starts
Program 2 opens file A
Program 2 close file A
Program 2 exits

Fails:
Program 1 starts
Program 1 opens file A
Program 1 close file A
Program 2 starts
Program 2 tries to file A ……. file busy error … enter a loop retry open every second
Note Program 1 still running

Now terminate program 1
Program 2 opens file A successfully
Program 2 close file A
Program 2 exits


Now we have tried liberal doses of flush but they do not seem to have any affect.

Suggestions?

Regards
Carl



Sponsored Link
Ads by Google

Response Number 1
Name: cup
Date: July 24, 2007 at 11:35:19 Pacific
Reply:

Alternative 1
Try sopen. That will open for shared access.

Alternative 2
Try mailslots for sending stuff between the programs

Alternative 3
Try shared memory for sending stuff betwen the programs

Alternative 4
Try pipes for sending stuff between the programs.


0

Response Number 2
Name: Carlls
Date: July 25, 2007 at 04:55:16 Pacific
Reply:

All good suggestions, but unfortunately not practical.

I have many codes, on the order of 200, that called in optimization loops.

I just really need to close and free a file completely from with a running program.

Never thought that she be so hard…


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


VBA/Excel Dynamic cell re... How do I detect keystroke...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Dangling file handles with MS w2k..

Python file handling www.computing.net/answers/programming/python-file-handling/13036.html

copy files only with a particular name www.computing.net/answers/programming/copy-files-only-with-a-particular-name/19939.html

file handling function in 'C'. www.computing.net/answers/programming/file-handling-function-in-c/2119.html