Posted on: 3/31/2011 8:41:14 PM | Views : 719

Hello,
 
I'm trying to read a fixed length file and display the contents in a web page.  My file is formatted like this...
Name                 Date
John Deere         3-30-11
 
my code below returns the following output...
Name Date
John Deere 3-30-11
 
 
string myFileName = "C:\\1.txt";
StreamReader objStreamReader = new StreamReader(myFileName,Encoding.UTF8);
objStreamReader = File.OpenText(myFileName);
string contents = objStreamReader.ReadToEnd();
lblRawOutput.Text = contents;
objStreamReader.Close();
 
 
I have found several articles on how to remove white spaces, but none on how to keep them.  
 
Any ideas?
 
Thanks.
...

Go to the complete details ...