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
 
Back
Top