View Single Post
Old 09-22-2006, 03:33 PM   #2 (permalink)
jaeusm
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default

You don't need to work with char arrays. Just use strings. This will work if you make the following changes:

Code:
// get rid of these two lines
char[] header = new char[41];
char[] line = new char[53];

// use this line instead
string header, line;
Code:
// change the way your reader works.  Do this
line = reader.ReadLine();

while (line != null)
{
    string company = line.Substring(0,7);
    string customer = line.Substring(14,9);
    string amount = line.Substring(32);
    writer.WriteLine(company + "," + customer + "," + amount);
    line = reader.ReadLine();
}

jaeusm is offline