c# - File.Create Async write keeps the file locked -


i need write file in async way, every half second. , can use c# on .net framework 2.0 .

i tried using file.create , beginwrite. keeps file locked, , need able access (read). tried fiddling security settings i'm not sure i'm doing there.

any appreciated!

edit:

var bytes = encoding.ascii.getbytes(stringbuilder.tostring()); var filepath = path.combine(output_folder, file_name); var filesteam = file.create(filepath, bytes.length, fileoptions.asynchronous); m_iasyncresult = filesteam.beginwrite(bytes, 0, int.maxvalue, writecallback, new state(filesteam));  private void writecallback(iasyncresult ar) {     var state = (state)ar.asyncstate;     var stream = state.stream;     stream.endwrite(ar);      m_iasyncresult = null; } 

you need make sure file opened non-exclusively. check post how can read text file without locking it?


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -