"Xero" <jeff_@_chezjeff_._net(remove_underscores_and_this )> wrote in message
news:43**********************************@microsof t.com...
How do you clear the content of a *.txt file?
System.IO.File.Open( "foo.xml", System.IO.FileMode.Truncate).Close
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
Derek Harmon