#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    20
    Rep Power
    0

    Nonblocking stdin input?


    I'm trying to do a nonblocking read (or scanf, fgets, etc.) from stdin using cygwin running in Windows XP. I've been told here that I cannot do select on stdin in Windows (which is a shame, as that would really fix my problems). Is there a definitive solution for doing a nonblocking read of a '\n' terminated string from stdin?

    Thanks,
    Bill
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,625
    Rep Power
    4247
    Haven't done any programming on cygwin for windoze, but is the curses library supported? If so, you can probably use timeout() or nodelay() to set non-blocking mode and getch() to read the key pressed.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo