My desired output is that if the while loop reads 75 characters first or encounters '.' in the input file(whichever occurs first), then line is stored as:
1 : Whatever text follows.
2 : Whatever text follows.
3 : Whatever text follows.
.
.
.
But this code doesn't seem to be working for me. I'd appreciate any help.
(I've checked that data.txt pre-exists.)
The issue is that depending on your compiler and library implementation, this program may or may not work. You just happened to have a compiler+library combo where it worked.
All you have to do to make it work 100% of the time is to #include <cstddef> and remove your own EXIT_ definitions.