Appending the content of a text file to another text file
Please support our C# advertiser: DiscountASP.NET – 3 Months Free on C# Web Hosting
Thread Solved
![]() |
Hello there, I've been busy nowadays with file manipulation and I've so far I've encountered a small problem in appending the contents of a file to another file. This is what I did:
It seems that I can't append the content of files2 to my Temp.txt file after placing the contents of files. Please help. Thanks.
string filename = @"C:\Temp.txt";
string body = null;
StreamReader sr = File.OpenText(files);
body = sr.ReadToEnd();
StreamWriter sw = File.Create(filename);
sw.WriteLine(body);
sr = File.OpenText(files2);
body = sr.ReadToEnd();
File.AppendAllText(filename, body);
sw.Close();
It seems that I can't append the content of files2 to my Temp.txt file after placing the contents of files. Please help. Thanks.
An Avalanche In D Minor
![]() |
Similar Threads
Other Threads in the C# Forum
- Introducing EchoQuiet (Community Introductions)
Other Threads in the C# Forum
- Previous Thread: File details in to List View using a file dialog box
- Next Thread: How to control Ms Powerpoint 2007 Slide show using C# 3.5?
•
•
•
•
Views: 997 | Replies: 3 | Currently Viewing: 1 (0 members and 1 guests)






Linear Mode