Special File Handling
*STDIO* Windows Standard IO Access
  This functionality is a +PxPlus Exclusive
Format OPEN (chan[,option])"*STDIO*"
-or-
SELECT ... FROM "*STDIO*"

Where:

chan Channel or logical file number.
options File options used to access 'stdin' / 'stdout'
  BSZ=num Block size
ERR=stmtref Error transfer
IOL=iolref Default IOList
OPT=char$ File open options
REC=name$ Record prefix (REC=VIS(name$) can also be used)
iolist The iolist iolist to be applied to stdin.
*STDIO* Logical file name (not case-sensitive).
   
Description The *STDIO* logical file can be used in the WIndows environment to gain access to the logical 'stdin' and 'stdout' files.

Normally when running on windows there is no stdin or stdout attached to the ProvideX process, however when launched from command line with piped input or output the process will have a stdin or standard output file assigned by the operating system. As all IO to channel zero is effectively routed to the windows screen, the application will need to specifically open *STDIO* in order to access these standard IO assignments.

When reading from stdin the input is considered a system device thus you should issue a READ to accept individual lines or READ RECORD to read a specific length of data.

   
Examples Reading Standard Input (stdin):

dir a* | pxplus prog01

In the program prog01 you could then read the output of the DIR command:

0010 OPEN (1)"*stdio*"
0020 WHILE 1
0030 READ (1,ERR=*BREAK)R$
0040 PRINT R$,
0050 WEND
0060 MSGBOX "all done"

Writing to Standard Output (stdout):

The following will output a sorted directory listing piping through the Windows sort command:

pxplus -mn prog02 | sort

Where the program prog02 contains:

0010 SET_PARAM 'SD' ! Include directory delimiter
0020 OPEN (1)"*stdio*"
0030 SELECT F$ FROM "." WHERE MID(F$,1,1)<>"."
0040 PRINT (1)F$
0050 NEXT RECORD
0060 CLOSE (1)

 

 



*Note* If neither stdin or stdout are allocated to the process, the OPEN will fail with file not found (Error 12)