cyberdin Posted November 27, 2004 Report Share Posted November 27, 2004 Dear Forum,I'm writing an application that reads a big file that is constantly open and being modified by another application. That file resides on a network drive. When the OS (windows 98 in my case) reads the file, it saves a local copy in cache, and the next time I call it, it compares the remote file parameters with the local. If they are the same (=the file hasn't changed), It simply gives me the local copy and saves communication time with the server. All that is done on a very low level. However, the other application that manipulates the file never closes it, and for some reason the file parameters don't get updated, although the file does. So to make a long story short, After I read the file once, I always get a cached copy, even though the source has actually changed in content. I've tried all the copying methods I know (in API), nothing works. The only way I found so far to get an updated copy of the file is to Copy/Paste it manually with the Windows Explorer. Is there a way to simulate this copy/paste programatically? (I've searched MSDN for the Clipboard functions, but couldn't find the exact way to copy an actual file) or a way to invalidate the windows file cache? Any other idea is of course welcomed as well.Thank you very much in advance, Quote Link to post Share on other sites
CurlingSteve Posted November 27, 2004 Report Share Posted November 27, 2004 You should be able to set a flag in your OPEN_FILE call that indicates no buffering.This Thread in another forum sounds similiar to your problem.Back when I was programming more, to flush all the caches I'd do a close followed by an open to flush and clear all the buffers. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.