Hi,
if someone can help me how to read a line in the txt document. I know you read the first line or the entire document but i do not know how a particular line...
Dum_
0
Newbie Poster
Recommended Answers
Jump to PostFrom MSDN:
using System; using System.IO; class Test { public static void Main() { try { // Create an instance of StreamReader to read from a file. // The using statement also closes the StreamReader. using (StreamReader sr = new StreamReader("TestFile.txt")) { string line; // Read and …
Jump to PostUse something like this:
using (StreamReader sr = new StreamReader(path)) { while (sr.Peek() >= 0) { Console.WriteLine(sr.ReadLine()); } }
All 5 Replies
agent154
19
Junior Poster in Training
Dum_
0
Newbie Poster
agent154
19
Junior Poster in Training
Ramy Mahrous
commented:
Very good
+8
ddanbe
2,724
Professional Procrastinator
Featured Poster
Ramy Mahrous
commented:
well
+8
Dum_
0
Newbie Poster
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.