I appreciate the help but I didn't think I was entering into a spelling bee. All I want to know is what is the best (most efficient, cross OS, generic) way of locking a file (to read in and modify the contents and then write them back to the same file using, if possible, the same filehandle). I don't want to have to read in a file with a lock, modify the contents, close that handle, then open the file again with a lock to write back. This leaves a small window between locks where the file could get read in before another user has his changes saved (the latter user would then overwrite the first user's changes). The application should be able to accomplish this on as many platforms as possible (Windows would come first, Unix, Linux). I'd appreciate any HELPFUL input on this, not posts that simply are used to criticize or weak attempts at trying to impress with their vocab with no helpful insight.
in reply to Read/Update File