Reading in a text file and using the data.

  • Thread starter Thread starter Paul Lemelle
  • Start date Start date
P

Paul Lemelle

I am trying to read in a text file then use the data in the file.

I know how to read a file wiht the System.IO namespace:

FileRead fr = new StreamReader("data.txt");
Console.Writeline(fr.Readline());

or

StreamReader fr = File.OpenText("Data.txt");
string buffer = null
While ((buffer = re.Readline()) !+ null)
{
Console.Writeline(buffer);
}
fr.close;

But how do I use the data after it is read? In short, I would like to
store the data in a varabile.

Paul
 
Just assign it to a variable instead of dumping it to the console.

Before you ask how to do that, read up on the assigment operator (=).
 
Back
Top