QDOS SuperBASIC File Exists Function

Anything QL Software or Programming Related.
User avatar
Posts: 2816
Joined: Wed Dec 01, 2010 10:39 pm

Re: QDOS SuperBASIC File Exists Function

Post by dilwyn »

Although I think you can send to a pipe in "vanilla" QDOS, you need an extension to extract info from the other end. So this doesn't meet your needs. Turbo compiler provides one (CONNECT), as does QLiberator (Q_PIPE), to

1.open a pipe channel of suitable length in bytes to send information to, called ACTIVE channel
2.open a channel to retrieve info, what the QLib manual calls PASSIVE.
3.the active channel number is normally higher than the passive
4.EOF can be used to mark end of data

100 OPEN #4,PIPE_2048 : REMark #4 for output
110 Q_PIPE #4 TO #3 : REMark #3 is input
120 DIR #4,dddn_
130 INPUT #3,title$
140 INPUT #4,capacity$
150 REPeat loop
160 IF EOF(#3):EXIT loop
170 INPUT #3,filename$ : PRINT filename$
180 END REPeat loop
190 CLOSE #4: CLOSE #3

(untested, typed in from memory)

QLib manual warns "if you completely fill a pipe with data, the active end will wait until the pipe is emptied. End Of File is signalled at the passive en when the active end is closed."

Post Reply