read, append to a text file
Hello,
VS 2005
What is the best and most efficient method for reading from a text file. Storing it in a temporary file or variable, and then finally appending it to another file.
Its important the file that it is being appended to does not overwrite what is already in there.
Many thanks for any advice,
Steve
Re: read, append to a text file
Add at top of .cs file:
Reading:
VB Code:
string path = "C:/text.txt";
string temp = File.ReadAllText(path);
Appending:
VB Code:
File.AppendAllText(path, temp);
Hope that helps :)