How to merge two text files
Please support our C# advertiser: DiscountASP.NET – 3 Months Free on C# Web Hosting
![]() |
•
•
Posts: 1,734
Reputation:
Solved Threads: 184
Firstly, think of how you would want to do it, write it down.
Work out some code that looks like it should do what you wanted.
try it, what does it do?
if it doesnt work, post it, explain what you're getting you didnt expect, and ask for assistance.
Dont post just asking for us to do it for you
Work out some code that looks like it should do what you wanted.
try it, what does it do?
if it doesnt work, post it, explain what you're getting you didnt expect, and ask for assistance.
Dont post just asking for us to do it for you
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Open the first file with FileMode.Append.
Open the file to append with FileMode.Open.
Read the file to append into a byte array.
Write the byte array to the first file.
Open the file to append with FileMode.Open.
Read the file to append into a byte array.
Write the byte array to the first file.
"If you judge people, you have no time to love them." Mother Teresa
Make love, no war. Cave ab homine unius libri.
First rule of debugging: "If you get a different error message, you're making progress."
Danny
Make love, no war. Cave ab homine unius libri.
First rule of debugging: "If you get a different error message, you're making progress."
Danny
•
•
Posts: 46
Reputation:
Solved Threads: 4
hi
try using namespace System.IO;you will find two classes responsible for reading and writing from file with more options are :
- StreamReader ;
- StreamWriter ;
u can read ur file using StreamReader the write it using StreamWriter
but after using ur StreamReader and Writer close them EX :
StreamReader sr = new StreamReader(Strin Path);
TextBox1.Text=sr.ReadLine();
sr.close(); ------------> close reader;
and the same with Writer ;
there is another class File contains static members
File.ReadAllText();
File.WriteAllText();
File.open(string path , filemode.append);
all these depends on ur application if u wana preview ur text file and append with another file or u wanna do ur method during procesisng ur code ;
there is more but that easy ways u can append ur txt files
bye
try using namespace System.IO;you will find two classes responsible for reading and writing from file with more options are :
- StreamReader ;
- StreamWriter ;
u can read ur file using StreamReader the write it using StreamWriter
but after using ur StreamReader and Writer close them EX :
StreamReader sr = new StreamReader(Strin Path);
TextBox1.Text=sr.ReadLine();
sr.close(); ------------> close reader;
and the same with Writer ;
there is another class File contains static members
File.ReadAllText();
File.WriteAllText();
File.open(string path , filemode.append);
all these depends on ur application if u wana preview ur text file and append with another file or u wanna do ur method during procesisng ur code ;
there is more but that easy ways u can append ur txt files
bye
•
•
•
•
Originally Posted by BlackSun
TextBox1.Text=sr.ReadLine();
What's the relevancy with this question ?
"If you judge people, you have no time to love them." Mother Teresa
Make love, no war. Cave ab homine unius libri.
First rule of debugging: "If you get a different error message, you're making progress."
Danny
Make love, no war. Cave ab homine unius libri.
First rule of debugging: "If you get a different error message, you're making progress."
Danny
That's very inventive BlackSun.
But if I drink wine I use a wineglass.
When I drink a coffee I use a coffeecup.
Do you drink wine from a coffeecup?
Don't use a textbox for this, but use a string.
But if I drink wine I use a wineglass.
When I drink a coffee I use a coffeecup.
Do you drink wine from a coffeecup?
Don't use a textbox for this, but use a string.
"If you judge people, you have no time to love them." Mother Teresa
Make love, no war. Cave ab homine unius libri.
First rule of debugging: "If you get a different error message, you're making progress."
Danny
Make love, no war. Cave ab homine unius libri.
First rule of debugging: "If you get a different error message, you're making progress."
Danny
![]() |
Similar Threads
Other Threads in the C# Forum
- How can show/view Infopath dynamic files(xml) without infopath in a computer (XML, XSLT and XPATH)
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- Merge Files , in c++ (C++)
- Trying to get a program to extract data from a text file (C++)
- how to read many text file? (C++)
- Merge Sort (C++)
- How to handle multiple files, to Excel (VB.NET)
- Trying to compare the contents of two text files and save the difference (Python)
- How to open multiple textfile (Visual Basic 4 / 5 / 6)
Other Threads in the C# Forum
- Previous Thread: want to login to windows through c#
- Next Thread: Problems with transaction in SQL Server Mobile
•
•
•
•
Views: 1448 | Replies: 6 | Currently Viewing: 1 (0 members and 1 guests)






Linear Mode