Programming And The File-cache


Recommended Posts

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,

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...