View Single Post
Old 07-19-2008, 09:23 AM   #1 (permalink)
techexpert
Junior Member
 
Join Date: Jul 2008
Posts: 1
Default How to read file content in .net?

Hi, Following is the code for How to read file content through .net?

Offshore Outsourcing Software Development Company::Web Application Development::Ecommerce Web Site Design Solution

public String ReadFileContent(FileSettings file)

{

FileStream fs = new FileStream(file.FilePath,FileMode.Open,FileAccess. Read);

StringBuilder output = new StringBuilder();

StreamReader r = new StreamReader(fs);

r.BaseStream.Seek(0,SeekOrigin.Begin);

String fContent="";

while (r.Peek() > -1)

{

fContent = fContent + r.ReadLine();

}


r.Close();

return fContent;

}


-------------------------------------

Offshore Outsourcing Software Development

Last edited by techexpert : 07-19-2008 at 09:25 AM.
techexpert is offline   Reply With Quote
Sponsored Links