correction to non-blocking post

I have a non-blocking read implemented but a non-blocking way to get data
from the keyboard and write it out over the port. I don’t know which it is
blocking on but its either getchar() or write() more than likely it is
getchar(). Sorry for the confusion and I writing from one serial port over
a Null Modem to another serial port. And as I stated the only thing wrong is
it blocks on getchar() or write().

Kevin

Hi Kevin,

Why do you think it’s good idea to write there and here about the same problem? I saw a lot of your
posts last week or two and I also saw the correct answers your questions. You could use kbhit()
functions (or call it bioskey() if you’re fan of Borland C) or also it’s possible to use
tcischars() directly. This function tells you if you have any char from keyboard for reading, so
next step should be to analize the kbhit()'s returned value and call getchar() or don’t call
getchar(). It’s ugly way of polling in *nix program, but it should work in your particular case.

inline int kbhit()
{
if (tcischars(1) > 0)
return 1;
else
return 0;
}

Best regards.

Eduard.
ed1k at ukr dot net

Kevin Weisser <kweisser@udel.edu> wrote in article <ae58tf$c8a$1@inn.qnx.com>…

I have a non-blocking read implemented but a non-blocking way to get data
from the keyboard and write it out over the port. I don’t know which it is
blocking on but its either getchar() or write() more than likely it is
getchar(). Sorry for the confusion and I writing from one serial port over
a Null Modem to another serial port. And as I stated the only thing wrong is
it blocks on getchar() or write().

Kevin