[Haskell-cafe] Re: [Haskell] reading from stdin

Stefan O'Rear stefanor at cox.net
Thu Oct 4 21:36:20 EDT 2007


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 haskell at ..., but nothing else seemed to match.

This is a thread for haskell-cafe at .

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071004/557b23d4/attachment.bin


More information about the Haskell-Cafe mailing list