[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Trapping getChar before echo

Subject: Re: [Haskell-cafe] Trapping getChar before echo
From: Andrew Coppin
Date: Sun, 31 Jan 2010 12:57:44 +0000
Michael Hartl wrote:
import System.IO
import Data.Char

main = do
  hSetEcho stdin False
  hSetBuffering stdin NoBuffering
  hSetBuffering stdout NoBuffering
  scanLine
where scanLine = do c <- hGetChar stdin
              putChar . toUpper $ c
              scanLine
Last time I tried something like this [on Windows], it didn't seem to
work. I wanted to trap arrow keys and so forth, but they seem to be
being used for input history. (I.e., pressing the up-arrow produces
previously-entered lines of text, and none of this appears to be
reaching the Haskell program itself.) Has this changed since I tried it
last year?
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>