On Monday 15 November 2004 3:02 am, K-sPecial wrote: > Rajesh Dorairajan wrote: > > Does anyone know of a way to open a file in append mode and append > > on top of the file? > > > > Thanks in Advance, > > > > --Rajesh > > I don't know why people are having a problem with this sollution, > simply open in append mode so open doesn't clobber the file, then use > seek() to move to the beginning of the file. Done :) >
The problem is that if you do that, you're going to overwrite the existing data with every write you do. What is required when appending to the front (oxymoron as append means to stick on the end), is that the existing data is shuffled down when you write. To clarify. if you had aaaaa bbbbb ccccc ddddd and did as you suggested to write 'fffff' you would end up with fffff bbbbb ccccc ddddd See? > --K-sPecial > > [ http://xzziroz.freeshell.org > irc://xzziroz.dtdns.net ] -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>