Text Files: How To

  • Thread starter Thread starter Chang
  • Start date Start date
C

Chang

hello ng,

how can I read/write/clear a ascii text file in one go (same also for
binary file). also while i am doing that no other application/process should
be able to read/write/clear to that file. also what process/method should i
call to see if there is any read/write/clear is happening on a file.

thanks,
c
 
You can seek around files all you like, but the ability to read/write/clear the
file
in one pass is going to be very specific to the type of file you are working
with.

For your scenario, you'll want to open the file using FileShare options.
Specifically
you are looking for FileShare.None. If you can't obtain exclusive access to the
file
you'll get an exception.
 
Back
Top