the function that would be helpful for you here, i think, is STRTOK
in the string.h library.
it will separate any text into "tokens" based on a set of "delimiters"
your "tokens" will be individual lines, and your set of "delimiters" will simply be the newline character '\n'
once you have your individual lines you can insert anything you want in between them, and then rewrite them to a buffer or another text file as you desire.
http://www.cplusplus.com/reference/clibrary/cstring/strtok.html
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
the function that would be helpful for you here, i think, is STRTOK
Nope -- just use fgets() as previously suggested. No need to read the file one character at a time just to find line terminators because that's doing it the hard way.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
oh, dur.
you're right.
brainfart.
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179