Re: Append on top (easy sollution)

2004-11-16 Thread K-sPecial
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

RE: Append on top (easy sollution)

2004-11-15 Thread Ron Goral
> -Original Message- > From: Gary Stainburn [mailto:[EMAIL PROTECTED] > Sent: Monday, November 15, 2004 7:25 AM > To: [EMAIL PROTECTED] > Subject: Re: Append on top (easy sollution) > > > On Monday 15 November 2004 3:02 am, K-sPecial wrote: > > Rajesh Dorai

Re: Append on top

2004-11-15 Thread Gary Stainburn
On Monday 15 November 2004 1:43 pm, NYIMI Jose \(BMB\) wrote: > > However, if you do have these restrictions it can be done using the > > psudocode below > > > > calculate write_size > > seek EOF-buffer_size > > read buffer_size > > seek EOF-buffer_size+write_size > > repeat until at BOF Don't forg

RE: Append on top

2004-11-15 Thread Shaw, Matthew
> Rajesh Dorairajan wrote: > > Does anyone know of a way to open a file in append mode and append on top of > > 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 > mo

RE: Append on top

2004-11-15 Thread NYIMI Jose \(BMB\)
> -Original Message- > From: Gary Stainburn [mailto:[EMAIL PROTECTED] > Sent: Monday, November 15, 2004 2:25 PM > To: [EMAIL PROTECTED] > Subject: Re: Append on top > > > On Friday 29 October 2004 10:35 am, Ing. Branislav Gerzo wrote: > > Rajesh Doraira

Re: Append on top

2004-11-15 Thread Gary Stainburn
On Monday 15 November 2004 1:25 pm, Gary Stainburn wrote: [snip] > > calculate write_size > seek EOF-buffer_size > read buffer_size > seek EOF-buffer_size+write_size > repeat until at BOF > Oops, missed out the final lines of code, which are: seek BOF write new data bit of a pointless excercise

Re: Append on top

2004-11-15 Thread Gary Stainburn
On Friday 29 October 2004 10:35 am, Ing. Branislav Gerzo wrote: > Rajesh Dorairajan [RD], on Thursday, October 28, 2004 at 18:11 > (-0700) thoughtfully wrote the following: > > RD> Does anyone know of a way to open a file in append mode and > append on top of RD> the file? &g

Re: Append on top (easy sollution)

2004-11-15 Thread Gary Stainburn
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

Re: Append on top (easy sollution)

2004-11-15 Thread Jenda Krynicky
From: K-sPecial <[EMAIL PROTECTED]> > 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 peo

Re: Append on top (easy sollution)

2004-11-14 Thread K-sPecial
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(

Re: Append on top

2004-11-01 Thread Chasecreek Systemhouse
On Tue, 02 Nov 2004 01:10:40 +0100, Jenda Krynicky <[EMAIL PROTECTED]> wrote: > It seems though that the constant doesn't matter much. I've tried to > copy a 709MB file using a tiny script that looked like this: ... > and it took 171s with 8*1024 and 176 with 5000 and 32*1024 byte > chunks. > > O

Re: Append on top

2004-11-01 Thread Jenda Krynicky
From: Chasecreek Systemhouse <[EMAIL PROTECTED]> > On Sun, 31 Oct 2004 22:04:33 +0100, Jenda Krynicky <[EMAIL PROTECTED]> > wrote: > > > Something like that. 1024 is one K. So 8*1024 is 8KB. > > > > I don't know what the size of a block is when reading from the > > particular disk storing that fi

Re: Append on top

2004-11-01 Thread Chasecreek Systemhouse
On Sun, 31 Oct 2004 22:04:33 +0100, Jenda Krynicky <[EMAIL PROTECTED]> wrote: > Something like that. 1024 is one K. So 8*1024 is 8KB. > > I don't know what the size of a block is when reading from the > particular disk storing that file, but the block size is usualy some > power of 2 in KB. 2KB,

RE: Append on top

2004-10-31 Thread Jenda Krynicky
From: Ajey Kulkarni <[EMAIL PROTECTED]> > >>> while (read OLDFILE, $buff, 8*1024); > > A quick qn. :) Y is 8*1024 being mentioned here? Are you just > word-aligning or something else? Something like that. 1024 is one K. So 8*1024 is 8KB. I don't know what the size of a block is when reading from

Re: Append on top

2004-10-29 Thread John W. Krahn
Jenda Krynicky wrote: From: [EMAIL PROTECTED] This is the way I would do it, however my code has been subject to criticism more that once in the past :) open (FILE, "; close (FILE); $new_data = "This is my new line that I am going to put at the top\n"; unshift (@file, $new_data);

RE: Append on top

2004-10-29 Thread Rajesh Dorairajan
Title: RE: Append on top I looked at the archives and found a mail by NYMI Jose where the code was pretty neat. It was actually for inserting in the middle of the file. However, I could not get it to append on top. I am enclosing the mail containing his code as attachment if someone likes to

RE: Append on top

2004-10-29 Thread Ajey Kulkarni
>>> while (read OLDFILE, $buff, 8*1024); A quick qn. :) Y is 8*1024 being mentioned here? Are you just word-aligning or something else? regards -Ajey On Fri, 29 Oct 2004, Jenda Krynicky wrote: > From: [EMAIL PROTECTED] > > This is the way I would do it, however my code has be

RE: Append on top

2004-10-29 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > This is the way I would do it, however my code has been subject to > criticism more that once in the past :) > > open (FILE, " @file = ; > close (FILE); > $new_data = "This is my new line that I am going to put at the top\n"; > unshift (@file, $new_data)

RE: Append on top

2004-10-29 Thread brian . barto
die; print FILE @file; close (FILE); -Original Message- From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED] Sent: Friday, October 29, 2004 9:34 AM To: Mandar Rahurkar; Rajesh Dorairajan; [EMAIL PROTECTED] Subject: RE: Append on top > -Original Message- > From: Mandar Rahurkar

RE: Append on top

2004-10-29 Thread NYIMI Jose \(BMB\)
> -Original Message- > From: Mandar Rahurkar [mailto:[EMAIL PROTECTED] > Sent: Friday, October 29, 2004 3:18 PM > To: Rajesh Dorairajan; Perl-Beginners ([EMAIL PROTECTED]) > Subject: Re: Append on top > > > read the file. Rewrite ur data into the file foll

Re: Append on top

2004-10-29 Thread Mandar Rahurkar
read the file. Rewrite ur data into the file followed by original data. easy way.. Mandar Original message >Date: Thu, 28 Oct 2004 18:11:54 -0700 >From: "Rajesh Dorairajan" <[EMAIL PROTECTED]> >Subject: Append on top >To: "Perl-Beginners ([EMAIL PRO

RE: Append on top

2004-10-29 Thread Bob Showalter
Rajesh Dorairajan wrote: > Does anyone know of a way to open a file in append mode and append on > top of the file? No, because that's not what "append mode" means. To insert data anywhere but at the end, you have to rewrite the file contents from the point of insertion for

RE: Append on top

2004-10-29 Thread NYIMI Jose \(BMB\)
> -Original Message- > From: Ing. Branislav Gerzo [mailto:[EMAIL PROTECTED] > Sent: Friday, October 29, 2004 11:36 AM > To: [EMAIL PROTECTED] > Subject: Re: Append on top > > > Rajesh Dorairajan [RD], on Thursday, October 28, 2004 at > 18:11 (-0700) thoug

Re: Append on top

2004-10-29 Thread Ing. Branislav Gerzo
Rajesh Dorairajan [RD], on Thursday, October 28, 2004 at 18:11 (-0700) thoughtfully wrote the following: RD> Does anyone know of a way to open a file in append mode and append on top of RD> the file? I don't think it is possible. You have to read source file, and after print your res

RE: Append on top

2004-10-29 Thread arjun.mallik
This mode will append text at the bottom not at the top. Arjun -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, October 29, 2004 2:45 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Append on top open(MYNAME,">>a.txt");

RE: Append on top

2004-10-29 Thread Sreedhar . Kalkunte-Venkatachala
open(MYNAME,">>a.txt"); -Original Message- From: Rajesh Dorairajan [mailto:[EMAIL PROTECTED] Sent: 29 October 2004 02:12 To: Perl-Beginners ([EMAIL PROTECTED]) Cc: Rajesh Dorairajan Subject: Append on top Does anyone know of a way to open a file in append mode and appe

Append on top

2004-10-29 Thread Rajesh Dorairajan
Does anyone know of a way to open a file in append mode and append on top of the file? Thanks in Advance, --Rajesh