Reading in a text then using the data?

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
 
A

Andrew Faust

In short, I would like to store the data in a varabile.

You answered your own question in your example.

string buffer = null
buffer = re.ReadLine()
 
B

bob clegg

Hi,
It seems like you are probably stuck breaking up the line of data into
its component parts.
If the fields are fixed length then you can simply use
mystring,Substring(n,y)
If not see if the data lends itself to the use of Regular expressions
to capture its component parts.

hth
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top