home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4694 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  1.4 KB

  1. Path: sparky!uunet!olivea!mintaka.lcs.mit.edu!ai-lab!wheat-chex!bkph
  2. From: bkph@wheat-chex.ai.mit.edu (Berthold K.P. Horn)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: OF_VERIFY, SHARE etc
  5. Message-ID: <1ihnhhINN4o@life.ai.mit.edu>
  6. Date: 7 Jan 93 16:59:29 GMT
  7. Organization: MIT Artificial Intelligence Lab
  8. Lines: 31
  9. NNTP-Posting-Host: wheat-chex.ai.mit.edu
  10.  
  11.  
  12. How can one get OF_VERIFY to really work? 
  13. -----------------------------------------
  14.  
  15. I want to be able to tell whether a file has changed since I last looked at it.
  16. OpenFile with OF_VERIFY doesn't seem to do the right thing --- that is,
  17. it never returns HFILE_ERROR.   I do something like:
  18.  
  19.     if ((hFile = OpenFile(OpenName, &OfStruct,    
  20.         OF_REOPEN | OF_VERIFY | OF_SHARE_DENY_NONE)) == HFILE_ERROR) { 
  21.  
  22. I'v tried various variations of this, including (LPSTR) NULL in place of
  23. OpenName (string with the file name), leaving off the OF_REOPEN etc.
  24.  
  25. Now I have to resort to _fstat to check length and date/time, since 
  26.  
  27. I suppose I could directly compare the four reserved bytes in OfStruct,
  28. which seem to be some kind of file date/time code.  But then that may
  29. change in future...
  30.  
  31.  
  32. How can one tell whether SHARE has been loaded?
  33. ---------------------------------------------
  34.  
  35. If it is not, then I don't have to worry about getting `Sharing Violations'
  36. when I open a file WITHOUT specifying OF_SHARE_DENY_NONE or
  37. OF_SHARE_DENY_READ/WRITE/EXCLUSIVE.
  38.  
  39.  
  40. Berthold K.P. Horn
  41. Cambridge, Massachusetts, USA
  42.