Well you have several choices. You can read in the file, one line at a time, and write it to a temp file, and at the correct time shove your own line in there. When finished reading in the original file, write the temp file back out to it. You could read in input file into an array, and do an insert at the correct place. This could be the beginning of an Editor of some sort if you stuck on a GUI. If the text file is small enough, you could read it into one giant string. Then sub-string the part before the addition, add in your stuff, and concatenate in the last part of the string.
"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Inserting new line in the middle of a existing file