I am writing a serial program that reads directly from the keyboard and
writes out to another computer I am almost completely done except I have a
blocking write in my program. I do a getchar then i check to see if it is
the exit key if it is i exit otherwise I do a write(). I was wondering if
there exists some kind of non blocking getchar or a way to see if get char
returned anything or if I need a non-blocking write(). Suggestions are
appreciated.
I am writing a serial program that reads directly from the keyboard and
writes out to another computer I am almost completely done except I have a
blocking write in my program. I do a getchar then i check to see if it is
the exit key if it is i exit otherwise I do a write(). I was wondering if
there exists some kind of non blocking getchar or a way to see if get char
returned anything or if I need a non-blocking write(). Suggestions are
appreciated.
Check out the select() function. You will find a pretty good example there
as well