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 se
> -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
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
> 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
> move to the beginning of the file.
> -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
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
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?
>
> I don't think it is p
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 o
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 people are having a problem with this sollution,
> simply open in
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
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
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
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,
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
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);
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
>>> 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
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)
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
> -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
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 PROTECTED])" <[EMAIL PROTECTED]>
>Cc:
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 forward. Or, you need to wr
> -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
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 results to new f
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");
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 append on top of
the f
26 matches
Mail list logo