"mark van..." wrote:

> I am writing some blog software, but I can't figure out how to write to
> the beginning of a file, because when I print to the file it always
> goes at the end. Also, I don't want to overwrite the existing text in
> the file, I want to insert the new text.

What is the code you are now using?  It sounds like you are opening for
append, which automatically prints to the end of the target file.  To
insert at the beginning, you will have to:

open an temp output file
print your insertion text to this
open the existing file and pass existing text through to the replacement
file.
close both files
rename the temp file with the original filename [you may have to delete the
existing file to do this].

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to