Re: [Haskell-cafe] Re: [Haskell] reading from stdin
On 10/5/07, Reinier Lamers [EMAIL PROTECTED] wrote: You can probably unify the behaviors of platforms a, b and c by calling hSetBuffering on stdin to turn off buffering. I'm not so sure about this. I had a similar problem (GHC6.6.1 on Windows) where I had an app that wanted character-based console input on Windows. Calling hSetBuffering stdin NoBuffering didn't actually give me no buffering; not only that, but my app seemed to have readline-like input behavior on the console where I could go back to previously typed lines using the arrow keys, and my app wouldn't see anything until I hit Enter. -- ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] reading from stdin
Axel Simon wrote: a) is the behaviour I want, but unfortunately for platform d) b) must be due to ghci and Hugs having different opinions on whether stdin should be line buffered or unbuffered c) this is weird d) this is broken You can probably unify the behaviors of platforms a, b and c by calling hSetBuffering on stdin to turn off buffering. Reinier ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] reading from stdin
On Thu, Oct 04, 2007 at 05:46:09PM +0100, Axel Simon wrote: Hi, I'm trying to continuously output data to a file handle while reading single characters from the user to adjust the speed at which things are output. I'm interested to get this to work in Hugs on Windows. I successfully used the following function ghci under Mac OS: {{{ getUserInput :: IO (Maybe Char) getUserInput = do hasInput - hReady stdin if hasInput then liftM Just (hGetChar stdin) else return Nothing }}} This function returns a character to me if there's one available. If anybody could give me a hint how to get this working in Hugs under Windows, please tell me. Something in the 'win32' package, or maybe the FFI. MSDN will be very handy. P.S.: Sorry to post to [EMAIL PROTECTED], but nothing else seemed to match. This is a thread for [EMAIL PROTECTED] Stefan signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe