[Coco] basic09 - append to file

Aaron Wolfe aawolfe at gmail.com
Tue Jan 11 20:42:04 EST 2011


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 :)

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



More information about the Coco mailing list