(win32) What to do when a file remains left open when a remote application crashes or forgets to clo

Posted by Stephane R. on Stack Overflow See other posts from Stack Overflow or by Stephane R.
Published on 2010-06-02T13:00:59Z Indexed on 2010/06/02 13:04 UTC
Read the original article Hit count: 253

Filed under:
|

Hi

I have not worked so much with files: I am wondering about possible issues with accessing remote files on another computer. What if the distant application crashes and doesn't close the file ?

My aim is to use this win32 function: HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle);

Using the flag OF_SHARE_EXCLUSIVE assures me that any concurrent access will be denied (because several machines are writing to this file from time to time).

But what if the file is left open ? (application crash for example ?) How to put the file back to normal ?

© Stack Overflow or respective owner

Related posts about win32

Related posts about files