Link to home
Start Free TrialLog in
Avatar of saswati_m
saswati_m

asked on

read flat file

I am trying to read a fixed width flat file from C# code, any ideas ?
Avatar of iHadi
iHadi
Flag of Syrian Arab Republic image

if you mean a text file:

string str = File.ReadAllText("File_Path");
Messagebox.Show(str);
ASKER CERTIFIED SOLUTION
Avatar of felipecsl
felipecsl

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of winsoftech
winsoftech

C#
--------------------------------------------------------------------------------------------------------------------------------------------------      StreamReader sr=new StreamReader(FilePath);
      Header=sr.ReadLine();
      string Detail=String.Empty;
        while(sr.Peek()>=0)
         {
             Detail=sr.ReadLine();
         }
      sr.Close();
                MessageBox.Show(Detail);
Avatar of Bob Learned
Dog pile!!!

string[] lines = File.ReadAllLines("File_Path");

Bob