Reputation: 21
I want to use StreamWriter to write in a file that already exists in my project's debug folder. How can I do that? I thought StreamWriter can only write to a whole new file.
Upvotes: 2
Views: 3273
Reputation: 2393
Do you mean append?
StreamWriter sw = new StreamWriter("abc.txt", true);
sw.WriteLine("test");
sw.Close();
Upvotes: 2
Reputation: 39278
using(var sw = new StreamWriter("yourfile.txt", true))//default location is your bin folder
{
}
Use the above overload
Upvotes: 0