C# How to modify text file -


I need to read accounts.txt and add / change numbers after password

here accounts .txt

  User | Password user1 | Password1  

after launch

  users | Password | 1 user1 | Password1 | 1  

after closing

  users | Password | 0 user1 | Password1 |  

Sorry for my English

First, add system.io :

Read it for:

  string [] accounts = file. Read offline ("accounts.txt"); /     account [0] + = "| 1"; // it adds / />  

| 1 "near the password account [0]. Change (" | 1 "," | 0 ");" 0 "text" | 1 "to

and to write:

  File.WriteAllLines (" accounts.txt ", account);  

Comments