[Tutor] Adding Text to the Beginning of a File
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Fri Nov 5 22:02:21 CET 2004
On Fri, 5 Nov 2004, Alan Colburn wrote:
> Can anyone offer me a suggestion for how to add text to the beginning of
> a file?
Hi Alan,
The simplest approach I'd recommend is to not do that. *grin* Files act
very much like VCR tapes sometimes: they don't make it very easy to splice
new content at the beginning.
Instead, you can take a slightly different approach: you can open a new
file, write your text, and then write the content of your old file. The
new file ends up having the content that you want.
You can then rename the old file out of the way, and then rename the new
file in its place.
Would that work for you? Good luck!
More information about the Tutor
mailing list