I wrote:
> wrote:
>
> > If you mean what channels are assigned to pre-opened channels on the
> > stack,
> > I seem to recall that they are #0 = stdin, #1 = stdout and #3 = error.
>
> Ooops! #2 = error, not #3
->sigh<-
It got a bit late last night! I had to dig out the manual in the end. My
first take
was sort of right, but see below.
> Of course in SBasic you dont have to compile it first, thus the program:
>
> 100 REMark test pipe
> 110 :
> 120 REPeat l
> 130 IF EOF(#0): EXIT l
> 140 INPUT#0; l$
> 150 PRINT#1; l$
> 160 END REPeat l
> 170 PRINT#2; CMD$
> 180 BEEP 2,2
> 190 QUIT
>
> Invoked by
>
> EX "ram1_test_bas", "ram1_test_bas", #1, #2; "This is an error"
>
> would copy the source of the program to channel #1 and "This is an error"
on
> channel #2
That works as advertised for SBasic, but to achieve the identical effect in
a QLiberated program the following modification is required:
100 REMark test pipe
110 :
120 REPeat l
130 IF EOF(#0): EXIT l
140 INPUT#0; l$
150 PRINT#3; l$
160 END REPeat l
170 PRINT#1; CMD$
180 BEEP 2,2
190 QUIT
Invoked with
EX "ram1_test_obj", "ram1_test_bas", #1, #2; "This is an error"
which will copy the source of the program to channel #1 and "This is an
error" to channel #2
QLib skips channel #2 and, for some reason, takes a different view of the
channel order from SBasic (which seems to be the "correct" order to me).
You are not limited to three channels.
Per
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm