Re: Writing to beginning of file

2002-03-11 Thread Johannes Franken
On Sat, Mar 09, 2002 at 11:36:08PM -0800, Troy May wrote: > How do you write to the beginning of a file? That's an easy one: Just turn the file around, and append to its end. # cat > regular first second third ^D # mkfifo backwards # while : ; do tac regular > backwards; done & [1] 18464 # cat b

Re: Writing to beginning of file

2002-03-10 Thread Elaine -HFB- Ashton
Troy May [[EMAIL PROTECTED]] quoth: *>Hello, *> *>How do you write to the beginning of a file? I see only 3 options to open a *>file: to read, to overwrite, and to append to the end of the file. *> *>I tried seeking to the beginning before the write, but it doesn't work. *>Seek must only work fo

Re: Writing to beginning of file

2002-03-10 Thread John W. Krahn
Troy May wrote: > > Hello, Hello, > How do you write to the beginning of a file? I see only 3 options to open a > file: to read, to overwrite, and to append to the end of the file. > > I tried seeking to the beginning before the write, but it doesn't work. > Seek must only work for a read. >

Re: Writing to beginning of file

2002-03-10 Thread Jon Molin
Troy May wrote: > > Hello, > > How do you write to the beginning of a file? I see only 3 options to open a > file: to read, to overwrite, and to append to the end of the file. > If you think about the file as an array with one char on each index: my @string = split (/|/, "this is a test"); n

RE: Writing to beginning of file

2002-03-09 Thread Timothy Johnson
Well, there's really no way to write to the beginning of a file without pushing the rest of the contents back. If you had been successfull with your seek attempt, you would have overwritten the beginning of the file. Probably your best bet would be to create a temp file like this: open(TEMP,">