Click to See Complete Forum and Search --> : serious file locking question
hExReX
Mar 3rd, 2001, 05:45 PM
Hi. I'm working on a project that modifies a data file used by another program. I always get "file in use" or "sharing error" whenever I try to write to the file. I imagine this is because the other program has locked the file... is there any way to "un-lock" the file and make it available to my program for modifying it?
I don't know if it is possible, but I would like it if it could be. I am not interested in using code that will terminate the other program.
- vb newbie
parksie
Mar 3rd, 2001, 06:07 PM
The usual case is not that the other program has specifically locked the file, but because it has the file open for reading/writing, which immediately prevents any other programs from accessing it.
hExReX
Mar 3rd, 2001, 07:35 PM
Oh. I have no clue whether it has locked it or what, but I would like to be able to access the file -- is this possible?
Would it instead be possible to Open the file with my program and set the Shared setting so that both programs could modify it? (or would that still not work if both were accessing it)
parksie
Mar 3rd, 2001, 07:41 PM
It won't make any difference, I'm afraid. Think about it...the other program is writing to the file while your program's reading. How do you tell what data your program will get? Is it the data from before or after? Or is it parts of both? It's impossible to tell.
hExReX
Mar 3rd, 2001, 10:11 PM
actually the program is a game that uses a data file that needs to be modified to play different missions. The game only reads from the data file, and I need to be able to write to it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.