By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,915 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,915 IT Pros & Developers. It's quick & easy.

Merge Text File

P: n/a
Is there a quick way to merge two text files?
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
use the copy command in a Console Window.
-----Original Message-----
Is there a quick way to merge two text files?
.

Nov 16 '05 #2

P: n/a

string str = string.Empty();
StreamReader sr = File.OpenText("file01.ext");
StreamWriter sw = File.AppendText("file02.ext");

while( ( str = sr.ReadLine() ) != null )
sw.WriteLine(str);
"MFRASER" <mf*****@henwoodenergy.com> wrote in message
news:eS**************@TK2MSFTNGP11.phx.gbl...
Is there a quick way to merge two text files?

Nov 16 '05 #3

P: n/a
If they are both of the same encoding, treat them as binary files, Read a
constant block size in a loop and write into the second file.

If they're both of different encoding type, you'd need to read them in as
string (using ReadLine APIs) and write them using the appropriate encoding.

-vJ

"MFRASER" <mf*****@henwoodenergy.com> wrote in message
news:eS**************@TK2MSFTNGP11.phx.gbl...
Is there a quick way to merge two text files?

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.