private static string ReadDeleteHashFromFile(string MyFilePath) { string lastline = ""; using (StreamReader reader = new StreamReader(dumpFilePath)) { using (StreamWriter writer = new StreamWriter("myfile.tmp")) { string line = reader.ReadLine(); while (!reader.EndOfStream) { writer.Write(line); line = reader.ReadLine(); if (!reader.EndOfStream) writer.Write(writer.NewLine); } lastline = line; } } File.Delete(MyFilePath); File.Move("myfile.tmp", MyFilePath); File.Delete("myfile.tmp"); return lastline; }
c# читаем последнюю строку и удаляем её / Get last line from file and delete it
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.