How do I capture <STDIN>?
Posted: Fri Feb 06, 2009 1:14 pm
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???
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???