Hello Group
I have the following StringBuilder object code:
//----Begin CODE----------
StringBuilder record5 = new StringBuilder();
record5.Length = 94; //Set length
record5.Insert(0,"0520"); //Insert at position 0
record5.Insert(4,"4CCC");
record5.Insert(20,"20CCCC");
record5.Insert(40,"40CCCCCC");
record5.Insert(50,"50D");
record5.Insert(53,"53EEEEEE");
//Insert character at the last position
record5.Insert(93,"X");
StreamWriter myFile = File.AppendText("MYFILE.txt");
myFile.WriteLine(record5);
myFile.WriteLine(record5);
myFile.Close();
//---End of Code---
The problem is the characters are not inserted at specified positions, plus there are lot of spaces after the 94th character which is "X" ...
Thus the file is not written in the format I want to. Plus when I print this text file from notepad, there is one blank line between the first 'record5' and then second 'record5'. I just can't figure out why ?! Please help.
Thanks in advace.
C# Newbie !
I have the following StringBuilder object code:
//----Begin CODE----------
StringBuilder record5 = new StringBuilder();
record5.Length = 94; //Set length
record5.Insert(0,"0520"); //Insert at position 0
record5.Insert(4,"4CCC");
record5.Insert(20,"20CCCC");
record5.Insert(40,"40CCCCCC");
record5.Insert(50,"50D");
record5.Insert(53,"53EEEEEE");
//Insert character at the last position
record5.Insert(93,"X");
StreamWriter myFile = File.AppendText("MYFILE.txt");
myFile.WriteLine(record5);
myFile.WriteLine(record5);
myFile.Close();
//---End of Code---
The problem is the characters are not inserted at specified positions, plus there are lot of spaces after the 94th character which is "X" ...
Thus the file is not written in the format I want to. Plus when I print this text file from notepad, there is one blank line between the first 'record5' and then second 'record5'. I just can't figure out why ?! Please help.
Thanks in advace.
C# Newbie !