Doubt in C-Sharp

  • Thread starter Thread starter Baskar RajaSekharan
  • Start date Start date
B

Baskar RajaSekharan

Hi,

I create one new file called 1.txt using either FileStreamObject or
FileInfo object. I wite some content into the Text. After that I want to
Erase all the content without deleting the File. Is it possible? If so,
please let m e know how to do that in c-Sharp?

Regards,
R.Baskar
 
Closing the FileSteam and reopening 1.txt (using another FileStream
instance) with FileMode.Truncate as the FileMode should do the trick. (I
just tried it and it worked for me)

hope this helps,
Fred
 

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

Similar Threads

how to convert this C function into C-Sharp ? 1
doubt 1
Doubt 5
How to Erase a FileContent in c -Sarp? 7
Doubt 1
Doubt 2
Doubt 4
doubt in C# 1

Back
Top