I have the following code to read a line from a text file.
In the UpdateFile() method I need to delete the existing one line and update it with a new line.
Can anybody please provide any ideas?
FileInfo JFile = new FileInfo(@"C:\test.txt");
using (FileStream JStream = JFile.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None))
int n = GetNUmber(JStream);
n = n + 1;
private int GetNUmber(FileStream jstream)
StreamReader sr = new StreamReader(jstream);
string line = sr.ReadToEnd().Trim();
int.TryParse(line, out result);
private int UpdateFile(FileStream jstream)