C
C#14mo 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
SinFluxx14mo ago
How are you doing it so far?
Ewan
EwanOP14mo ago
No description
Ewan
EwanOP14mo 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
SinFluxx14mo ago
How would you normally repeat an action with code?
Ewan
EwanOP14mo ago
uhh not sure? i just wanna know how to swap lines because i can only read the first line
SinFluxx
SinFluxx14mo 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
EwanOP14mo ago
does RealLine() read every new line??
SinFluxx
SinFluxx14mo ago
it reads the next line from where the reader currently is
Ewan
EwanOP14mo ago
oh!! i didnt know using ReadLine multiple times goes onto the next line
SinFluxx
SinFluxx14mo 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
EwanOP14mo ago
ooo ok thank you!!!

Did you find this page helpful?