Sign in to follow this  

C# - writing to a file and clearing it

Recommended Posts

I'm writing to a file like this:
FileStream file = new FileStream("playlist2.txt", FileMode.OpenOrCreate, 
StreamWriter output = new StreamWriter(file);

but if there were two lines in the file it writes over the first one and keeps the last one. how can i clear out good file before writing to it?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this