You could open the file for read and write, find the line of interest, seek backwards to start of line, then overwrite it. BUT, I agree with MonkE. Text files lines are usually variable length. This means that for the single file approach to work the new line must be exactly the same length as the original.