StreamWriter

Dec 16 2003 6:03 AM
I want to open a new file and keep on appending the text depending on some condition. I have used this code but it is not appeneding properly It is giving some numbers in the output file if(index=="3") { files=new FileStream(filetext1.Text+"\\"+tgname+"\\"+"GlobalDeclarations"+".cs",FileMode.Append,FileAccess.Write,FileShare.ReadWrite); swriter=new StreamWriter(files); if(san==0) { swriter.WriteLine("using System;"); swriter.WriteLine("using System.IO;"); swriter.WriteLine("namespace "+ " "+tgname+"\r\n"+"{"); swriter.WriteLine("public class GlobalDeclarations"+"\r\n"+"{"); } } swriter.WriteLine(rtb2.Text); swriter.Close(); } Where am i wrong?

Answers (1)