Reading in a text file and using the data.

Reading in a text file and using the data.

am 02.11.2007 04:13:53 von 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

Re: Reading in a text file and using the data.

am 02.11.2007 06:57:18 von Stephany Young

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 (=).


"Paul Lemelle" wrote in message
news:8j4li39get98uihbnuvfteccvqp1il6anl@4ax.com...
>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
>