[XML-SIG] Deleting and appending of a file, without reading into memory
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Fri, 4 May 2001 00:03:22 +0200
> 1. delete 14 characters off the end of the file (the closing tag)
> 2. add some new data text from a cgi script onto this
> ie - file.append(cgi_resxml)
> 3. - then add back on the closing tag (14 character '</root>')
> ie - file.append('</root>')
>
> I can manage (2.) & (3.) no problems opening the file handler with append
> access ('a'), but I can't get into to do (1.) as well... does this append
> function have a reverse function and can I use that, or should I be doing
> this a differn't way?
What kind of file object do you have that has an append function?
I'd use f.seek to go 14 characters before the end, and start writing
there. Some operating systems don't even support truncation to a
certain size; they all support positioning to a given offset, though.
Regards,
Martin