So you can save the result of )HOST in
a variable if you use
⍎. To feed it a var, I would try
something like:
]BOXING 2
⎕←FILE←⍎')HOST
cat test.txt'
hello, world This
file was written in my $HOME directory. 0
⍴FILE
5
FILE
.→-----------. .⊖.
.→-------------------------------------------. .⊖.
.→-.
|hello, world| | |
|This file was written in my $HOME directory.| | |
|0 |
'------------' '-'
'--------------------------------------------' '-'
'--'
Several things to note here. First of
all, linefeeds / carriage returns / whatever
you want to call them in the file I
read seemed to mark nested array ends, and
it seems that those LFs were lost. I
don’t know how GNU APL handles LF chars,
so I would recommend you either keep
the array boxed or disclose it like I did
in the first example (∊ enlisting it
simply catenated all the lines together, as
the LFs were represented by ⊂⍬, boxed
empty vectors).
Second, if you’re reading this Jürgen,
note that even though ]BOXING was set
to 2, the result of ⎕←FILE is not
boxed.
IMHO this is potentially the cleanest
way to read a file. I have no idea how to tie
files and stuff like that.
Best of luck,
Louis
Hi Bug-apl,
Currently, at a point in my
code I do something like this:
⍝assume the variable 'yadda'
exists and is correctly formed, as well
as the read_file function
success←yadda ⎕fio[7] tie←
'wr'⎕FIO[3] "yadda.file"
yadda_new← read_file
"yadda.file.new"
⍝end of code
My question is: is there
either 1. a way to feed )host a variable
(I don't think that is possible) or 2. a
better way to implement this task in its
entirety. I find it a small nuisance
that I have to write and then read a
file in my code to access non-APL stuff
for processing.
-Alex