C
C#7mo ago
Ewan

✅ How do i read the next line in a text file

So i have a text file with like 5 different lines. When i read it, it only outputs the first line, how do i swap to the next line and then the next ect?
11 Replies
SinFluxx
SinFluxx7mo ago
How are you doing it so far?
Ewan
Ewan7mo ago
No description
Ewan
Ewan7mo ago
im doing it like this however it just reads the first line i dont want it to read all the lines at once but to output each line in the file individually
SinFluxx
SinFluxx7mo ago
How would you normally repeat an action with code?
Ewan
Ewan7mo ago
uhh not sure? i just wanna know how to swap lines because i can only read the first line
SinFluxx
SinFluxx7mo ago
Well ReadLine() will read the next line (as it has done in your code), so you just need a way to keep asking for the next line, a loop of some sort perhaps?
Ewan
Ewan7mo ago
does RealLine() read every new line??
SinFluxx
SinFluxx7mo ago
it reads the next line from where the reader currently is
Ewan
Ewan7mo ago
oh!! i didnt know using ReadLine multiple times goes onto the next line
SinFluxx
SinFluxx7mo ago
If you hover pretty much any symbol in your ide it will give you information on what it does/how it works:
No description
Ewan
Ewan7mo ago
ooo ok thank you!!!