Best practice for controlling file IO operations?

  • Thread starter Thread starter Lisa
  • Start date Start date
L

Lisa

Hi guys!



I'm manipulating multiple files (reading and writing) but I sometimes get
errors because the files haven't been completely processed by the O.S.
before my code tries to read and or manipulate the files. I can place a
Thread.Sleep(3000) in my code to wait for the O.S. to finish but there
should be a better way to do this.



Is there a way to know when file operations have been completed by the O.S.
so I can continue processing my code to use the files?



I'm using C# on the PPC.



Thanks
 
I have not tried this, but you may be able to use File.FileAttributes. It
should return -1 if the file is not accessible so you may be able to poll it
until it returns something other than -1.

Otherwise, if you post a specific situation I can try to help you out.

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top