Hello,
I'm using the code below for writing text in a text file.
StreamWriter dosya = new StreamWriter("mac.txt");
dosya.WriteLine("first line");
dosya.WriteLine("second line");
dosya.Close();
But I couldnt be able to find, how can I delete all data in this text file?
Loading
VulpesPosted Jun 27, 2011, 3:58 AM
Morcos AdelPosted Jun 27, 2011, 3:31 AM
i think that if you wanna delete all the Data in a text file and not deleting the file
you can do the following:
StreamWriter Sw=new StreamWriter("mac.text");
Sw.AutoFlush=true;
Sw.close();
hope this hepls :)
Jiteendra SampathiraoPosted Jun 27, 2011, 3:05 AM
yokzuPosted Jun 27, 2011, 3:04 AM
File.Delete("mac.txt");