peeking into stdin (programing question)

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: John (EBo) David
Date:  
Subject: peeking into stdin (programing question)
Nick Estes wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Use select or poll (I prefer poll personally, but they both work)


ok... this works except I cannot see or read the character until I type
a CR. How do I set stdin to be RAW (similar to ncursers cbreak)?

I tried modifying the file descriptor with:

    if (-1 == fcntl(fileno(stdin), F_SETFL, O_NONBLOCK|O_NDELAY)) /* and
tried it without delay */
      return 1;


and reopending stdin with:

in = open ("/dev/stdin", O_RDONLY| O_NONBLOCK | O_NDELAY);

but I'm still unable to get info back until I type a RETURN.

EBo --


> > sorry for the simple programing question. I've done this before and
> > spaced how.
> >
> > I need to check if there is input in the standard input in both C and
> > C++. If there is then processit, otherwise keep on going.
> >
> > can someone hit me with a clue stick?