C
chad
I have an text file with the following numbers
1
3
5
7
3
9
Now the program reads in this file. When it encounters a '\n', it will
do some stuff and then move to the next line. For example, it will
read 1 and then '\n'. When it sees '\n', it will do some stuff and go
on to read 3.
The problem is when I get to the last line. When the program sees '\n'
after the 9, everything works fine. However, when there isn't a '\n',
the program doesn't process the last line.
What would be the best approach to handle the case of the possible
missing '\n' at the end of the file?
1
3
5
7
3
9
Now the program reads in this file. When it encounters a '\n', it will
do some stuff and then move to the next line. For example, it will
read 1 and then '\n'. When it sees '\n', it will do some stuff and go
on to read 3.
The problem is when I get to the last line. When the program sees '\n'
after the 9, everything works fine. However, when there isn't a '\n',
the program doesn't process the last line.
What would be the best approach to handle the case of the possible
missing '\n' at the end of the file?