473,320 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Appending multiple RTF file into one

49
Can anyone help me out in this? I want to append multiple RTF file into one RTF file. I tried using 'streamwriter', the resulting file size becomes big and when i open it, it is the original i.e the first RTF file only and not the appended one. But i open the file with notepad it looks appended. I've supplied my code below . I've searched thru internet a lot but didn't get anything. So if anybody hav a solution plz help me out.

I'll explain something 'bout the code.
File in path1 is a new blank file i.e to b created.
File in path2 and path3 have contents.

using system;
using system.IO;

try
{
string path1 = @"C:\amit.rtf";
string path2 = @"C:\T0000072.rtf";
string path3 = @"C:\T0000073.rtf";
FileStream file2 = new FileStream(path2, FileMode.OpenOrCreate, FileAccess.ReadWrite);
FileStream file3 = new FileStream(path3, FileMode.OpenOrCreate, FileAccess.ReadWrite);
StreamReader sr2 = new StreamReader(file2);
StreamReader sr3 = new StreamReader(file3);
string s = sr2.ReadToEnd();
string s1 = sr3.ReadToEnd();
StreamWriter sw1 = new StreamWriter(path1);
sw1.WriteLine(s);
sw1.WriteLine(s1);
sw1.Close();
sr2.Close();
sr3.Close();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message.ToString());
}
Dec 11 '06 #1
0 1031

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dmiller23462 | last post by:
Hey guys.... I put an error-handling in my page and have it posted at the complete end of the code, see below(when people were putting in 's I was getting the delimiter errors). Great, I...
1
by: Eli Sidwell | last post by:
I have an Access DB that contains 5 tables for the last 5 years. All 5 tables have the same structure. I wanted to keep each year separate for organizational purposes. But, I want to query all 5...
13
by: sherifffruitfly | last post by:
Hi all, I'm trying to distill all of the info from google searches into what I need, with partial success. In truth, the whole xmlNode, Document, Element, etc group of classes & methods is going...
0
by: HydroPnik | last post by:
Hi all! What a great community you have here. Being an Access newbie I have already used much information gleaned from the other posters for my current project. I have been tasked with creating a...
2
by: Vivek | last post by:
Hi, Iam using the db2load API to write data to a table. I see that by default the load process creates/overwrites the msgfile. Is there a way to change this behaviour so that messages are...
7
by: Someone11 | last post by:
Ok not sure if this is where im meant to post my problem. But currently i'm generating a report through a webpage coded using vb.net. I create the reporitng service and set the credentials and...
1
by: Frank | last post by:
Hi, Let's say I have a file named myFile.xml Within that file I have blocks of data which I'd like to add at different times during the day. e.g. <LogEntry>
2
by: sarada purkait | last post by:
hii i have to write into a file from the start and then go on appending to it .. i tried using ( ios::out|ios::app) but by this the file keeps on appending every time i run the program and the...
9
by: JWM81274 | last post by:
Is there a statement that will allow appending to the end of table when inserting new data? I use multiple "insert into table1(timestamp1,area1,value1,value2...)" to insert different area data with...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.