Delete data in a text file

  • Thread starter Thread starter Shawn
  • Start date Start date
S

Shawn

Hi.
I have a .txt file with some data in it. I'm trying to delete it's content,
but I can't quite figure out how.
This is my code so far:

streamWriter = New StreamWriter(fileStream, System.Text.Encoding.Default)
streamWriter.BaseStream.Seek(0, SeekOrigin.Begin)
streamWriter.Write("")
streamWriter.Flush()

Thanks,
Shawn
 

Ask a Question

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.

Ask a Question

Back
Top