|
-
Dec 14th, 2006, 12:32 PM
#1
Thread Starter
Frenzied Member
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
-
Dec 14th, 2006, 02:42 PM
#2
Hyperactive Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|