07-06-2009 02:33 PM
Hello folks,
Is it possible to prepend text to the beginning of a text file? That is, insert text at the beginning of a text file and simply "push" the rest of the contents of the file to a higher offset rather than overwriting the existing data?
Thanks for the help!
Chris
Solved! Go to Solution.
07-06-2009 02:41 PM - edited 07-06-2009 02:43 PM
Hi Chris,
no, it isn't...
You can do it the trivial way: read in the old text, prepend the header, write out the full new text...
Or the safe way:
- write header to new file
- read old file (in blocks) and write in append mode to new file
- delete old file
- rename new file to have the name of the original file