Re: Redirection and Screen I/O
Tim Hansell writes:
> I have been trying to write a program that outputs directly to the
> screen EVEN IF the user who invokes it happens to redirect output.
> I noticed that the ed.ex program just uses standard out for all of
> it's screen writes, so I thought I would modify it a little, and
> instead of setting SCREEN = 1, I would set SCREEN = open("CON","w")
> but if I do this, the screen is definitely messed up.
Euphoria handles screen writes via standard output and screen writes
via "CON" a bit differently. It detects when writes to standard output
are really going to the screen, and it modifies the output a bit
by expanding tabs to blanks, and taking care of the line-wrap
on/off feature (see wrap()). If you write to CON these things are not
handled by Euphoria, you have to accept whatever DOS normally does.
Also, writes to the screen via standard output happen immediately.
Writes via CON are buffered until a '\n' comes along. e.g.
integer f
f = open("CON", "w")
puts(f, "Hello")
atom t
t = time()
while time() < t + 5 do
end while
puts(f, "\nWorld\n")
You won't see "Hello" until after the 5-second delay loop.
Regards,
Rob Craig
Rapid Deployment Software
|
Not Categorized, Please Help
|
|