0

I created an "e-mail account database". You can create an account by entering your e-mail and password in a textbox. Finally, the e-mail and password are saved in a text file.

The code can be found here: http://prntscr.com/9fzt6u

An output example can be found here: http://prntscr.com/9fztbe

The problem is that everytime I add a new account, the existing one is overwritten. I would like to know how to append a new account to my text file.

Thank You!

Voicu
  • 56
  • 5
Revolution
  • 35
  • 8

2 Answers2

1

you need use other override

using(StreamWriter str = new StreamWriter("c:\\file.txt", true))
{
//todo
}

true check if file exists to append new line else create new file

Taras Kovalenko
  • 2,323
  • 3
  • 24
  • 49
0

You have to append the text instead of override. Look at this constructor for StreamWriter

Set append to true and it will work fine.

3dz9j56
  • 112
  • 7