I use few gforth codes & I now want to register results
when I try :
0 value output
\ some other code
50 testvar !
: test
s" .test" r/w open-file throw fd-out
testvar @ fd-out write-line throw
fd-out write-file throw
fd-out close-file throw
;
I got an memory address error
fd-out write-file
:119: Invalid memory address
fd-out >>>write-file<<<
Backtrace:
I refer to official documentation but I found nowhere what am I supposed to do to have right memory address depending on variable I set (can be either text & numbers (both)).
Francois,
In
s" .test" r/w open-file throw fd-outdoes fd-out get the correct value? I would expect atobeforefd_out, assumingfd_outis defined with Value.write-linerequires a string (write-line ( c-addr u fileid -- ior )file: General files), see https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Word-Index.html#Word-IndexSo
s" 50"would work for thewrite-lineinstead oftestvar @which is incomplete, as also an string address is needed on the stack.write-filealso requires a string (write-file ( c-addr u1 fileid – ior )file: General files), not just thefd_out.With these changes it should work, good luck!