07-10-2012 12:56 PM
Hi All,
I want to insert characters into the middle of a text file without overwriting the characters that are already there. The "Write to Text File" function replaces the old characters with the new ones. Is there a way to insert the new characters into position and move the old characters further out so that the file becomes longer as a function of the characters you add?
Thanks,
FB
Solved! Go to Solution.
07-10-2012 01:11 PM
No, you cannot insert data into the middle of a file on disk. You'll need to read in anything after the part that you want to move, add the new characters, then append the previous data. If the file is not huge, it is probably easier to read the entire file into a string, make the changes, and write it all back out again.
07-10-2012 01:44 PM
is this what you meant?
07-10-2012 02:10 PM
Apok,
I do believe that is in effect what he is asking for. But he wants that to be done with the file located on the disk drive. The problem with your example is that it doesn't show any of the file handling functions.
07-10-2012 02:13 PM
well, I didnt want to solve it for him...
07-10-2012 03:15 PM
Combining natand and apok's advice will give me what I need. Thanks, all.