OK, I wrote this program called Crypto that runs other programs in the background and captures their output and displays it in a window in HTML.
It also captures input from the window and send it to the other programs standard input.
OK, for QBasic and QB4.5, the output works perfectly, but the input part hangs.
Here's what I mean:
PRINT "<center><h1>Hello, World!</h1></center>"
SYSTEM
works just fine.
But
INPUT "", a$
PRINT a$
SYSTEM
hangs, instead of echoing the input back to the window.
I think this is because INPUT doesn't read from STDIN but instead is using a keyboard interrupt to read the keyboard directly. So I need to open STDIN as a file???
How do I do that???
How do I capture <STDIN>?
Right! To read from a file, one must tell QB to first open it. Assuming your file, STDIN, has no extension and is in the same directory as qb.exe, here's how:
Code: Select all
OPEN "STDIN" FOR INPUR AS #1
WHILE NOT EOF(1) 'allows reading all the lines in the opened file
LINE INPUT #1, A$ 'assigns the first line to the string variable A$
'your code here, to use the current data in A$
WEND
CLOSE #1
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish