Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Reading STDIN and Writing to STDOUT

Keywords: 	 STDIN STDOUT 

Question:

How do I write to standard output? In other words, just print output to the DOS window (you know, like a dir cmd that simply lists all the files to the screen). I also want to make sure it's to STANDARD output so it can be piped, redirected, etc.

I'm just a little surprised that I can't use the fileopen on the (what is it - 5?) std files. Apparently from what I've seen here, it DOES work with LPT, COM, etc. I would have thought it should have worked with the others as well.

Answer:

No way to easily write to stdout or read from stdin. But here are some workarounds for strdout/stdin.
  1. For stdin, pipe the data to a file. Then Winbatch can read the file

  2. for stdout, make sure WinBatch is started with the start /w switch. Have Winbatch write to a file. Then in the BAT file TYPE the file to move it to stdout.

  3. For interpreted/compiled:

    Look into the rtstatus() function.

    a=rtstatus()
    Message("A is",a)
    

Article ID:   W14221
Filename:   Reading Stdin and Writing to Stdout.txt