Merge Text File

  • Thread starter Thread starter MFRASER
  • Start date Start date
string str = string.Empty();
StreamReader sr = File.OpenText("file01.ext");
StreamWriter sw = File.AppendText("file02.ext");

while( ( str = sr.ReadLine() ) != null )
sw.WriteLine(str);
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top