| | |
Appending the content of a text file to another text file
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
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.
C# Syntax (Toggle Plain Text)
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
- 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: 1576 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast button c# chat check checkbox class client code color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption event excel file files form format forms ftp function gcd gdi+ http httpwebrequest image index input install java label list listbox listener login math mouseclick mysql networking object operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource saving serialization server sleep socket sql statistics stream string tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






