[Coco] basic09 - append to file

gene heskett gheskett at wdtv.com
Tue Jan 11 22:40:36 EST 2011


On Tuesday, January 11, 2011 10:37:02 pm Aaron Wolfe did opine:

> On Tue, Jan 11, 2011 at 7:15 PM, gene heskett <gheskett at wdtv.com> wrote:
> > On Tuesday, January 11, 2011 06:50:52 pm Aaron Wolfe did opine:
> >> Thanks.. I tried: SEEK #fp, EOF
> >> that seems to be bad syntax. �there is an EOF() function but that is
> >> boolean, seems to just compare current file pointer to the file size
> >> somehow. �If i could just read the value it is comparing, and use
> >> that as the seek argument, should work. �but, I'm not sure how to
> >> get that value. �I can't really be reading the entire file just to
> >> get to the end, too wasteful of resources for this application.
> > 
> > Humm, I'd swear on a stack of bibles I used it way back when.
> > 
> > I also know that I have a copy of the Dibble book, Inside basic09, but
> > I just spent 15 minutes touring the first two layers of cardboard
> > storage boxes in the basement without finding it. �That info is in
> > the file descriptors first $10 bytes I believe, so it should be
> > retrievable but would have to involve opening the working disk raw
> > and chasing thru the directory data to locate the filenam, and from
> > the 3 byte locatio there, seek to that fd sector and read it from
> > there. �I will �work on excavating it again tomorrow when I can move
> > the stuff on top someplace else and get to 4 or 5 more of those file
> > storage boxes. �The problem is finding that someplace else in that
> > disaster area.
> > 
> > Got it I think, fire up a 'syscall' and do an ss.siz, its on the
> > bottom of page 8-113 in the level2 manual, it reports the currently
> > open files size and one can then seek to that position, which would
> > be an eof error if you tried to read another byte.
> 
> ding ding ding we have a winner :)
> 
:)  Thanks for the flowers.

> syscall to getstat ss.siz followed by syscall to seek seems to work
> very quickly.  thanks!
> 
> OPEN #fp,"/DD/LOG/httpd.log":WRITE
> 
> (* getstat ss.siz *)
> rregs.A = fp
> rregs.B = $02
> reqid = $8D
> RUN SYSCALL(reqid,rregs)
> 
> (* seek to eof *)
> rregs.Y = rregs.U
> rregs.A = fp
> reqid = $88
> RUN SYSCALL(reqid,rregs)
> 
> WRITE #fp,target
> CLOSE #fp

Glad I could help. ;-)  Sorry it took so long to refresh the wet ram.
 
-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Drakenberg's Discovery:
	If you can't seem to find your glasses,
	it's probably because you don't have them on.



More information about the Coco mailing list