PDA

View Full Version : locking/unlocking files with c ?


b>d>>s
09-02-2003, 09:01 AM
hi, ive looked everywhere (still looking...) for examples on how to do this,

i know naff all about c so any help plz ?

+ theres no way to use lock resources via itcl for files outside of server control ?

thx

and if u want to write me an exe to lock/unlock file thatd be g*

w3rd
09-02-2003, 06:00 PM
afaik any file that is fopen()'d is locked while that program is still running and the file handle is still active(fclose() wasn't called)

correct me if i'm wrong ?

w3rd

FTPServerTools
09-03-2003, 02:37 AM
Open the file in write mode. That should lock it properly.
Also check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/lockfile.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/lockfileex.asp etc.. Its just basic win api stuff...

b>d>>s
09-03-2003, 06:41 AM
ok, cheers :O