Pieter Posted August 24, 2006 Share Posted August 24, 2006 How do I mark a file as 'in use' so that Windows can't delete/change it as long as the program is running? I'm trying to lock my configuration file so that the program won't begin acting weird suddenly. iPod + Online calendars = iPodCALsync Link to comment Share on other sites More sharing options...
xcal Posted August 24, 2006 Share Posted August 24, 2006 Hmm in what instance would 'windows' want to remove an innocent file? Anyway, probably setting its attribute would help. FileSetAttrib How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
trids Posted August 24, 2006 Share Posted August 24, 2006 If you open for Write-access, windows stops it from being deleted or renamed etc. Try different open modes for your specific purposes Link to comment Share on other sites More sharing options...
Pieter Posted August 25, 2006 Author Share Posted August 25, 2006 FileSetAttrib -------------------------------------------------------------------------------- Sets the attributes of one or more files. FileSetAttrib ( "file pattern", "+-RASHNOT" [, recurse]) Parameters file pattern File(s) to change, e.g. C:\*.au3, C:\Dir +-RASHNOT Attribute(s) to set/clear. e.g. "+A", "+RA-SH" recurse [optional] If this is set to 1, then directories are recursed into. Default is 0 (no recursion). Return Value Success: Returns 1. Failure: Returns 0 if encountered any errors. Remarks The file pattern cannot contain spaces! The attributes that can be modified with the function are + or -: "R" = READONLY "A" = ARCHIVE "S" = SYSTEM "H" = HIDDEN "N" = NORMAL "O" = OFFLINE "T" = TEMPORARY (Note that you cannot set the compressed/directory attributes with this function.)Write-only access is not listed. Am I looking on the wrong page? iPod + Online calendars = iPodCALsync Link to comment Share on other sites More sharing options...
trids Posted August 25, 2006 Share Posted August 25, 2006 FileOpen ( "filename", mode )Parametersfilename Filename of the text file to open. mode Mode (read or write) to open the file in.Can be a combination of the following: 0 = Read mode 1 = Write mode (append to end of file) 2 = Write mode (erase previous contents) 4 = Read raw mode 8 = Create directory structure if it doesn't exist (See Remarks).Both write modes will create the file if it does not already exist. The folder path must already exist (except using mode '8' - See Remarks). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now