there is about 5 threads here I am trying to reference regarding writing and overwriting a file. I understand the concept...

open file 1
open file 2
write line from file 1 to file 2
until it comes to the line that I wish to overwrite
....etc


I just can't put that to code, and I can't seem to modify the code I have seen on here to help me.
In my file, I have a string, separated by |'s on each line (1|hi|how|are|you). Each line starts with a number. The row I wish to replace is going to be the number from a counter (ie. if the counter is 4, I wish to replace row 4). I am replacing a string with a string (of the same length) (1|the|weather|is|nice) This string will not always be the same --the values of the replacement string are coming from textboxes.

I want it to have the ability to replace the i'th row (i being the counter)


any help? ideas? THANKS.