TIP: Click on subject to list as thread! ANSI
echo: cis.os9.6809.coco
to: Denise Tomlinson 71021,3274 (X)
from: Kevin Darling 76703,4227
date: 1991-10-27 00:26:11
subject: #12705-#End of files

#: 12713 S10/OS9/6809 (CoCo)
    27-Oct-91  00:26:11
Sb: #12705-#End of files
Fm: Kevin Darling 76703,4227
To: Denise Tomlinson 71021,3274 (X)

Denise,

Basic09 is neat.  Great for writing quick little tools and packing them into
new commands.  One way to seek to the end, is to use the Syscall subroutine
to access a low-level OS-9 status call, to get the filesize.  Then seek
to that spot and start adding on from there.

WARNING: seeking to a higher
number will always expand the file to that size.  Do NOT do something like
a "seek #path,4000000" because it'll try to grab 4 megabytes from your
disk... and all you can do is wait until it gets it or errors out .
Anyway, here's a sample you can run on a small ascii test file you've made:

PROCEDURE filesize
TYPE stack=CC,A,B,DP:BYTE; X,Y,U:INTEGER
DIM regs:stack
DIM path:BYTE \(* BYTE not INTEGER in this case

DIM I_GetStt:BYTE \I_GetStt=$8D
DIM SS_Size:BYTE \SS_Size=$02

INPUT "file ",f$ \ (* get a test file name that exists
OPEN #path,f$

regs.A=path
regs.B=SS_Size
RUN syscall(I_GetStt,regs) \ (* get the filesize

high=regs.X
IF high<0 THEN 
high=65536.+high
ENDIF 
low=regs.U
IF low<0 THEN 
low=65536.+low
ENDIF 
filesize=high*65536.+low
 
PRINT "filesize=",filesize \ (* print the filesize
SEEK #path,filesize \ (* seek to end of file
PRINT #path,"*test" \ (* optionally, add a string to the file
CLOSE #path
END 

There is 1 Reply.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.