Skip to content

Appending spaces to fixed length file

Sriraman

Asked Mar 24, 2006, 1:06 AM EST1 answer
Share
LinkedInX

I am new to this forum and also to C#.
I need to write data from database to a text file which is a fixed length file.
I am using a dataset reader to get the data and writing it to the file. but the problem is i need to append sufficient spaces to each field. how to add spaces and trim each field to specific length from C#?
Pls help

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    MyString.PadRight(TotalFixedSize - MyString.Length);
    0