Bit of an audacious one-liner, but you get the drift. Open the file in truncate
mode, then (as there's nothing really to do in truncate mode after having reset
the file to zero-length) close it.
Opening it with FileMode.Create will also achieve the same thing, and allow
you to use the FileStream afterwards, for instance,
Dim fileStream As System.IO.FileStream
fileStream = System.IO.File.Open( "foo.xml", System.IO.FileMode.Create)
'
' foo.xml is now zero-length, plus use can write to fileStream.
'
fileStream.Flush
fileStream.Close
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.