0

I am coding in c++ for the nintendo ds and must use the "FILE" type to access a text file. So I'm using fgets to view the contents of the text file but I don't see any way to view the contents of anything but the first line, looking in the documentation.

Is there another command that would do such a thing or is there a way to make fgets read a different line?

Matthew D. Scholefield
  • 2,977
  • 3
  • 31
  • 42

1 Answers1

3

Fgets will read from the FILE position where you are at. And when you use it, it reads a line and the position is now on the next line. So if you keep on calling it, it will give you all the lines. When EOF is reached it will return the line up to that point, and subsequent calls will return NULL.

jofra
  • 617
  • 6
  • 13