hi,
i am unable to read the newline using stream reader from a text file where it contains some names and their account ids. i need to copy each line to a string how can i change to next line. how can i know when end of file is reached???????

Recommended Answers

All 2 Replies

Do you mean ReadLn ?
Forgive me if there are syntax errors, typing this is off the top of my head.

StreamReader reader = File.OpenText("C:\\MyFile.txt");
            string line = reader.ReadLine();
            while (line != null )
            {
                // do something with the line. Assume a delimiter of Tab
                string Name = line.Split('\t')[0];
                string Account = line.Split('\t')[1];
                line = reader.ReadLine();
            }
            reader.Close();
            reader.Dispose();

Hello :

Thanks a lot jerry for this information I thinked about it .......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.