#: 4045 S10/Tandy CoCo
01-Jun-90 09:20:18
Sb: #4003-#SCF files
Fm: Jim Peasley 72726,1153
To: PHIL SCHERER 71211,2545 (X)
~
Phil;
I asked the same question quite a while back, and both Kev and Dave sent me
this subroutine that I use to seek to the end and append :
DIM path:BYTE; fsize:REAL
TYPE regs=cc,a,b,dp:BYTE; x,y,u:INTEGER
DIM register:regs
DIM callcode:BYTE
DIM xconv,uconv:REAL
(* filesize subroutine - courtesy K. Darling & D. Jenkins
70 ON ERROR GOTO 80 \(* open the file or append, but be ready for no file
OPEN #path,filenam:UPDATE
register.a:=path
register.b:=2
callcode:=$8D
RUN syscall(callcode,register)
xconv=register.x
IF xconv<0 THEN xconv=xconv+65536. \ ENDIF
uconv=register.u
IF uconv<0 THEN uconv=uconv+65536. \ ENDIF
fsize=xconv*65536.+uconv
SEEK #path,fsize
RETURN
80 (* Need to create initial file
errnum=ERR
ON ERROR
IF errnum=216 THEN
CREATE #path,filenam:WRITE
RETURN
ELSE
IF errnum>0 THEN
PRINT " Unexpected error - "; errnum \ END
ENDIF
ENDIF
This should do it for you.
...Jim
There is 1 Reply.
|